🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: IdTCPClient Connected question

#1382
From: Remy Lebeau (TeamB)
Date: Fri, 26 Jan 2007 06:03
52 lines
2868 bytes
"Dennis Jones" <nospam@nospam.com> wrote in message
news:45b9882b$1@newsgroups.borland.com...

> If the state is not known, then why does 'Connected' change from
false
> to true while it is trying to connect?

I already answered that earlier - the documentation explains exactly
what causes Connected() to return True.

> I fail to see anything that even remotely suggests that it returns
> true when it is in the process of establishing a connection.

Then you did not read it very carefully:

    TIdTCPConection.Connected()

    "Connected returns True when the connection contains a valid
IOHandler with a bound socket handle for the connection, and the
connection has not been closed unexpectedly."

In this case, "bound socket handle" does not mean "connected socket".
It means "allocated socket", as returned by the API socket() function.
TIdTPConnection.Connected() internally calls TIdIOHandler.Connected(),
which is a virtual method that involves all three of the following
methods (in this order):

    TIdIOHandlerStack.Connected()

        "Connected() calls the inherited method to retrieve the return
value for the function. The return value for the function is True when
the InputBuffer contains exisiting data, or when ClosedGracefully is
False and the InputBuffer is assigned."

    TIdIOHandlerSocket.Connected()

        "The return value for the method is determined by the values
provided by BindingAllocated() and the inherited Connected() method."

    TIdIOHandler.Connected():

        "The return value for the function is True when the
InputBuffer contains exisiting data, or when ClosedGracefully is False
and the InputBuffer is assigned."

Nothing in that says the connection has to actually be established.
Only that the socket has to be allocated and not considered
disconnected.


Gambit
Technical Details
Message-ID: <45b999a5$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45b9274f@newsgroups.borland.com> <45b938e2$1@newsgroups.borland.com> <45b95649$1@newsgroups.borland.com> <45b97154$1@newsgroups.borland.com> <45b9882b$1@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> <45b938e2$1@newsgroups.borland.com> <45b95649$1@newsgroups.borland.com> <45b97154$1@newsgroups.borland.com> <45b9882b$1@newsgroups.borland.com>
Subject: Re: IdTCPClient Connected question
Date: Thu, 25 Jan 2007 22:03:34 -0800
Lines: 54
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: <45b999a5$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1169791397 75.83.34.171 (25 Jan 2007 22:03:17 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail