Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Sep : TIDTCPServer OnExecute continues after Client disconnect using Indy 10 and BDS2
| Subject: | TIDTCPServer OnExecute continues after Client disconnect using Indy 10 and BDS2 |
| Posted by: | "Toby Piper" (ne..@compcraft.com) |
| Date: | Wed, 12 Sep 2007 15:38:30 |
Hi All,
I am just learning TCP/IP and Indy so this may be a stupid mistake on my
part.
I have written some test code that implements a client and a server.
Sometimes the server thread (OnExecute) method is continued to be called
after the Client has disconnected. This raises an exception when it tries to
readln again and the exception message is 'Connection Closed Gracefully.'
I have tried disconnecting (Acontext.Connection.IOHandler.Disconnect) in the
exception handler but that does nothing.
Any ideas?
One thing I have seen in the past that confused me for a while is that if I
don't read all of the input buffer it will continure to call OnExecute. Is
this also true if what I writeln out is not read by the client? If so, how
do I clear that out so the thread can close?
Also how do I clear the inputbuffer if I need to?
Thanks in advance,
Toby