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:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Fri, 16 Nov 2007 10:36:44

"Serge Kravchenko" <support@truecafe.net> wrote in message
news:473d7b01$1@newsgroups.borland.com...

> 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?

As I already explained, if you do not perform any operations on the socket,
the client will have to way of knowing what the socket status is.  You must
perform a read or write operation in order for the socket status to be
queried.

> procedure TfmMain.Server1Execute(AThread: TIdPeerThread);
> begin
>  Memo10.Lines.Add(aThread.Connection.ReadLn());
> end;

That is not thread-safe.

> 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.

Are you performing any operations on the client AFTER the server disconnects
it, though?  Your server is still not sending any data back to the client,
and I don't see you doing any reading operations on the client side.
Writting to a socket that was disconnected will set the ClosedGracefully
property to true and raise an exception.

> Does this all mean that since a client socket is connected once,
> it remains connected (Connected property = True) forever? :)

No.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive