Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Jan : Re: TidTcpserver ondisconnect

www.cryer.info
Managed Newsgroup Archive

Re: TidTcpserver ondisconnect

Subject:Re: TidTcpserver ondisconnect
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Thu, 24 Jan 2008 10:47:15

"emin" <none@none.com> wrote in message
news:47985d9e$1@newsgroups.borland.com...

> Can I use tcpclient connection or locklist method in Ondisconnect
> event of Tidtcpserver?

Yes.

> procedure TfrmTcpserver.ServerDisconnect(AThread: TIdPeerThread);
> begin
>
> ....
> try
>   frmSuperServer.TcpClient.connect;
>   frmSuperServer.TcpClient.WriteStream( stream );
> except
> end;

TIdTCPServer is a multithreaded component.  OnDisconnect is triggered for
each client that is connected to the server.  If multiple clients
disconnected at the same time, they would be accessing the same TIdTCPClient
at the same time.  So you need to protect that access from concurrent
access.  Otherwise, give each TIdPeerThread its own unique TIdTCPClient
object instance instead.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive