🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #137

Re: Hair 0, Indy10 1

#137
From: Remy Lebeau (TeamB)
Date: Fri, 30 May 2008 22:18
53 lines
2641 bytes
"Gene Buckle" <geneb@grumble.deltasoft.com> wrote in message 
news:48406d41@newsgroups.borland.com...

> Now the line:
> TCPClient = new TIdTCPClient(this);
> Dies during compile because "Could not find a match for TIdTCPClient::
> TIdTCPClient(classSimulator* const)", which is perfectly reasonable.

Yes, since your classSimulator class is not a TComponent descendant.

> That's why I'd changed it from "this" to NULL like the IOHandler
> below it.

That is perfectly fine to do.

> Now while calling it with (NULL) compiles, it doesn't actually appear to 
> work.

Yes, it does.

> When I do this:
> TCPClient->Host = "localhost";
> TCPClient->Port = 5500;
>
> and then
>
> ShowMessage(TCPClient->Host);
>
> The dialog shows nothing.

It should.  TIdTCPClient does not do anything to reset that property back to 
an empty string.

> I can call TCPClient->Connect() and get no exception,
> yet TCPClient->Connected() returns false.

You are using TIdIOHandlerStream, but you did not assign any TStream objects 
to its ReceiveStream and SendStream properties.

If you are trying to establish an actual TCP/IP connection, then you need to 
use TIdIOHandlerStack instead.  Or just leave the IOHandler set to NULL. 
Connect() will create its own TIdIOHandlerStack internally if you do not 
have your own IOHandler assigned.

> Calling TCPClient->IOHandler->Connected() (or anything else under
> TCPClient->IOHandler) just pitches an access violation exception.

It will only do that if the IOHandler is NULL, which is not the case in your 
code you have shown.


Gambit 
Technical Details
Message-ID: <48407d4c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <48406d41@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,9339fc05f2f275c
X-Google-Attributes: gid11508e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <48406d41@newsgroups.borland.com>
Subject: Re: Hair 0, Indy10 1
Date: Fri, 30 May 2008 15:18:00 -0700
Lines: 55
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 207.178.157.90
Message-ID: <48407d4c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1212185932 207.178.157.90 (30 May 2008 15:18:52 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 2475