Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jan : Re: Force client disconnect with TIDCmdTCPServer
| Subject: | Re: Force client disconnect with TIDCmdTCPServer |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Sat, 6 Jan 2007 02:07:16 |
"Gaspar" <noreply@noreply.com> wrote in message
news:459f02ed@newsgroups.borland.com...
> The problem is that the following statement raises a "Disconnected"
exception:
That is perfectly normal. Once the connection is closed, any further
read/write operations on that connection will throw an exception. Let
those other threads handle the exception in their own context as
needed.
> I thinks some read operation is in other thread, causing the
exception.
That is very likely, considering that TIdCmdTCPServer is a
continuously reading server. The thread that is throwing the
exception will handle it automatically and cleanup after itself as
needed. The only reason you are seeing the exception at all is
because you are likely running the code inside the IDE debugger at the
time, is that right?
> how to stop all read activity to disconnect gracefully?
You already are. Let the exception occur. It is part of Indy's
design. The thread will handle it accordingly.
Gambit
none