Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Aug : Re: 10054 Connection was reset by peer

www.cryer.info
Managed Newsgroup Archive

Re: 10054 Connection was reset by peer

Subject:Re: 10054 Connection was reset by peer
Posted by:"Gerhard Venter" (ieatspam4breakfast@spam.com)
Date:Tue, 22 Aug 2006 15:28:57

"Guillem" <guillemvicens-nospam@clubgreenoasis.com> wrote in message
news:xn0eq9wua6d86x000@newsgroups.borland.com...
> don't use a try..except. Use a try..finally. For example,
>
> idTCPclient.Connect;
> try
>  //do your stuff
> finally
>  idTCPClient.Disconnect;
> end;
>
> this way you enforce your TCP client to disconnect itself, whether
> there is an exception or not. It should help you prevent your problem
>

Actually I do but it still wont work but I found a funny work around that I
can't expain why it works, see below:

If I add the line marked, I don't have to restart my client app and can just
reconnect but if I take it out no luck. I cannot understand why as
Disconnect does do a call to that but it seems it never gets there.

try
    Self.IOHandler.Write('blah blah...');
finally
    Self.IOHandler.Close;   <=== Work around - add this line
    Self.Disconnect;
end;

Gerhard

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive