Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : Re: How to stop a Tid(Cmd)TCPServer while clients are connected?
| Subject: | Re: How to stop a Tid(Cmd)TCPServer while clients are connected? |
| Posted by: | "Chris Ueberall" (cuebera..@web.de) |
| Date: | 4 Dec 2007 16:40:28 |
Remy Lebeau (TeamB) wrote:
>
> "Chris Ueberall" <CUeberall@web.de> wrote in message
> news:4755ac7e$1@newsgroups.borland.com...
>
> > I used in the OnDisconnected Event the Contexts list, but because
> > the disconnecting raised an EIdNotConnected, which uses the
> > Contexts too, the deadlock occured.
>
> Such a deadlock would only occur if you were not unlocking the list
> correctly. The list itself is fine to use in that event, as the
> server does not keep the list locked while shutting down.
I used Contexts.LockList/UnlockList surrounded by try/finally.
Now I use a PostMessage to avoid the deadlock, that works fine.
--
Chris Ueberall;