Article View: borland.public.cppbuilder.internet.socket
Article #4582Re: [Indy 9.018 / CBuilder6] IdTCPServer Connection always NULL
From: Zoetjuh
Date: Fri, 14 Jan 2005 22:52
Date: Fri, 14 Jan 2005 22:52
42 lines
2613 bytes
2613 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:41e81519$1@newsgroups.borland.com...
>
> "Zoetjuh" <peter@i-hate-spam.zoetjuh.demon.nl> wrote in message
> news:41e80f47@newsgroups.borland.com...
>
>> void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
>> {
>> ShowMessage( AThread->Connection->ReadLnWait(100) );
>> }
>
> Do not use ShowMessage() like that. The OnExecute event is triggered in the
> context of a worker thread, not the main VCL thread. ShowMessage() displays
> a VCL form, which will not work property from any thread other than the main
> VCL thread because the VCL is not thread-safe. Use MessageBox() instead,
> which is thread-safe.
I know, maybe that was a very bad example, but I needed *some* command to point
out that the Connection really returnes NULL.
Nothing more, noting less...
>
> Also, it looks like you are trying to specify a timeout value to
> ReadLnWait(), is that correct? IF so, then you need to use ReadLn() instead
> of ReadLnWait(), as ReadLnWait()'s parameter is not a timeout to begin with.
>
>> However, nomatter what I try, The "Connection" is always NULL.
>
> That is not possible. The Connection property is valid for the lifetime of
> the socket that is bound to the TIdPeerThread. There is no way for
> OnExecute to trigger with a NULL Connection property. The Connection is
> assigned before OnExecute is triggered for the first time, and not freed
> until OnExecute is triggered for the last time. There is no in-between.
>
>
> Gambit
>
>
Check http://www.zoetjuh.demon.nl/isnull.jpg
It's there... :(
Technical Details
Message-ID:
<41e84d3b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41e80f47@newsgroups.borland.com> <41e81519$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,8d17184a33491515 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Zoetjuh" <peter@i-hate-spam.zoetjuh.demon.nl> Newsgroups: borland.public.cppbuilder.internet.socket References: <41e80f47@newsgroups.borland.com> <41e81519$1@newsgroups.borland.com> Subject: Re: [Indy 9.018 / CBuilder6] IdTCPServer Connection always NULL Date: Fri, 14 Jan 2005 23:52:44 +0100 Lines: 45 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 82.161.4.111 Message-ID: <41e84d3b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1105743163 82.161.4.111 (14 Jan 2005 14:52:43 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail