Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Nov : Re: Should TidTCPServer (Indy 9.0.10) automatically disconnect all clients when

www.cryer.info
Managed Newsgroup Archive

Re: Should TidTCPServer (Indy 9.0.10) automatically disconnect all clients when

Subject:Re: Should TidTCPServer (Indy 9.0.10) automatically disconnect all clients when
Posted by:"RandomAccess" (n..@tellingyou.com)
Date:Fri, 16 Nov 2007 17:45:39

Hi Serge,

I am new to Indy,  and from what I have observed,  I think the client socket
would show disconnected if you disconnect the server "before" the transfer.
Then,  when the transfer fails,  the client should show as disconnected.

This then means,  that you could poll the server with a simple command say
every few seconds,  to maintain regular connection status.

best regards


"Serge Kravchenko" <support@truecafe.net> wrote in message
news:473d7b01$1@newsgroups.borland.com...
> Hello Remy,
>
> Thank you very much for your observation!
>
> Initially I didn't transfer any data through the sockets, just activated
> server, connected the client and deactivated the server. Unfortunately, in
> this scenario the client socket remained connected. Is it OK?
>
> After reading your message I added the data transfer code:
>
> =================
>
> procedure TfmMain.SendTextMessage(Sender: TObject);
> begin
>  Client1.WriteLn(Memo9.Text);
> end;
>
> procedure TfmMain.Server1Execute(AThread: TIdPeerThread);
> begin
>  Memo10.Lines.Add(aThread.Connection.ReadLn());
> end;
>
> =================
>
> A text message is successfully transferred to the server side. However, in
> this scenario the client socket remains connected as well when I deactive
> the server socket.
>
> Does this all mean that since a client socket is connected once, it
> remains connected (Connected property = True) forever? :)
>
> (Did I overlooked anything?.. :)
>
> Thank you in advance!
>
> Regards,
> Serge.
>
> "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
> news:473c8de7$1@newsgroups.borland.com...
>>
>> "Serge Kravchenko" <support@truecafe.net> wrote in message
>> news:473c3757@newsgroups.borland.com...
>>
>>> To my surprise, the client remains connected
>>> (TidTCPClient.Connected = True):
>>
>> Was any data sent to the client before you shut down the server?  Did the
>> client perform any reading/writing operations?  The Connected() method is
>> not a true real-time status of the socket's current state.  If there is
>> any unread data in the InputBuffer, Connected() will continue to return
>> true even if the socket was closed, allowing the receiver to finish
>> processing any pending data it needs.  If no reading/writing operation is
>> performed at all, then the underlying socket is not accessed, and Indy
>> cannot react to the OS reporting that the socket was closed.
>>
>>> Should the server disconnect all connected clients?
>>
>> Yes.  But depending on what the rest of your code is doing, the client
>> might not react to it right way, even though it was closed on the server
>> side.
>>
>>
>> Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive