Article View: borland.public.cppbuilder.internet.socket
Article #5013Re: initialising a ClientSocket
From: Mark Jacobs
Date: Mon, 15 Nov 2004 13:27
Date: Mon, 15 Nov 2004 13:27
33 lines
2240 bytes
2240 bytes
Duncan, regarding this piece of code :-
file_client_pointer->Address = "10.98.88.34";
file_client_pointer->Port = 7017;
file_client_pointer->Open();
if(file_client_pointer->Active) ... etcetera
The Active property of the ClientSocket will not be set immediately in
non-blocking mode (the default) after calling the Open method. Instead, you
have to wait for the ClientSocket's OnConnect event to know for sure that you
are now connected. This is because BCB is just handing calls down to the
Winsock2 application layer, which eventually handles them and sparks off the
relevant events (OnConnect, OnError, ...). So, you need to move all of this
code :-
if(file_client_pointer->Active)
{
file_client_pointer->Socket->SendText("test_message");
}
into the OnConnect handler for the relevant Socket object. HTH,
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
"hans galema" <notused@notused.nl> wrote in message
news:4198a148$1@newsgroups.borland.com...
| I already told you the possible reason in my first post. You should
| not Sendtext in the same OnClick handler. Instead implement the
| OnConnect event of TClientSocket.
Technical Details
Message-ID:
<4198aed9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41938125$1@newsgroups.borland.com> <4193a0bb@newsgroups.borland.com> <41989b78$1@newsgroups.borland.com> <4198a148$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,f81efd77741cef0b X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mark Jacobs" <http://www.jacobsm.com/mjmsg?Borland%20Newsgroup> Newsgroups: borland.public.cppbuilder.internet.socket References: <41938125$1@newsgroups.borland.com> <4193a0bb@newsgroups.borland.com> <41989b78$1@newsgroups.borland.com> <4198a148$1@newsgroups.borland.com> Subject: Re: initialising a ClientSocket Date: Mon, 15 Nov 2004 13:27:59 -0000 Lines: 35 Organization: DK Computing X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 81.144.157.8 Message-ID: <4198aed9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100525273 81.144.157.8 (15 Nov 2004 05:27:53 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail