Article View: borland.public.cppbuilder.internet.socket
Article #1469Re: IdTCPClient Connected question
From: Remy Lebeau (TeamB)
Date: Thu, 25 Jan 2007 23:10
Date: Thu, 25 Jan 2007 23:10
39 lines
2308 bytes
2308 bytes
"Dennis Jones" <nospam@nospam.com> wrote in message news:45b9274f@newsgroups.borland.com... > When I try to establish a connection with a server, IdTCPClient's Connected > property returns true almost immediately upon calling the Connect() method If Connect() exits without throwing an exception, Connected() is guaranteed to return true until you perform a read/write operation. Remote disconects on a blocking socket be only be detected after a read/write operation has been performed. > and stays true until the call times out (if the server is unavailable). You can't call Connected() while Connect() is still running. The state of the connection is not stable until Connect() exits. > It seems to me that the Connected property should not return true > until a connection is properly established. It doesn't. Part of Connected()'s internal logic is that is reads any pending data from the socket (to see if the OS reports whether the socket was disconnected by the server), and then returns whether the socket is currently allocated. In the case of Indy 10, Connected() also returns true if there is unread data in the connection's InputBuffer. Besides, you shouldn't be calling Connected() until Connect() exits anyway. Why are you doing that? > How can I determine the *true* state of the client? Stop calling methods out of order. Gambit
Technical Details
Message-ID:
<45b938e2$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45b9274f@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,e8cbc2087e955870 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <45b9274f@newsgroups.borland.com> Subject: Re: IdTCPClient Connected question Date: Thu, 25 Jan 2007 15:10:52 -0800 Lines: 41 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.83.34.171 Message-ID: <45b938e2$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1169766626 75.83.34.171 (25 Jan 2007 15:10:26 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail