Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Sep : TIdTCPClient socket error
| Subject: | TIdTCPClient socket error |
| Posted by: | "Toby Piper" (ne..@compcraft.com) |
| Date: | Fri, 21 Sep 2007 10:59:28 |
Hello,
When the server I am connecting to has problems and hangs (a totally
different issue than this one) my TIdTCPClient eventually times out and
tries to resend the request - e.g. client.IOHandler.write( <server
request> ).
With the server hanging and not responding I eventually get a continuous
socket error on the client. I think (and I stress THINK) that it is
overflowing a buffer somewhere (but that is just a guess - so don't go down
that path if I am totally wrong).
What I want to know is: How do I close the connection when I get socket
errors (or any others)? I don't seem to be able to get it to close (why I
think I amy have data in a buffer somewhere).
I have tried clearing the buffers and disconnecting, but that doesn't seem
to do it.
on E: EIdSocketHandleError do
begin
LMSClient.Disconnect;
LMSClient.IOHandler.InputBuffer.Clear;
LMSClient.IOHandler.WriteBufferClear;
LMSClient.Disconnect;
end;
I guess I can destroy the client instance and redo eveything but that seems
drastic. Is there a better alternative?
Thanks,
Toby