Re: Connection closed Gracefully

Giganews Newsgroups
Subject: Re: Connection closed Gracefully
Posted by:  Remy Lebeau (Indy Team) (no.spam@no.spam.com)
Date: Fri, 29 Sep 2006

"Feijó" <fei…@x.suply.com> wrote in message
news:3A5D16939C09E340fei…@x.suply.com...

> Sometimes, dunno why, my app. popup that msg, stoping all processing.

That exception means that the other party has closed the connection on their
end, but your code kept trying to read/write to the connection afterwards.

Did you read the documentation yet?  Did you read the comments in the source
code for TdTCPConnection.CheckForDisconnect() (Indy 9) or
TIdIOHandler.RaiseConnClosedGracefully() (Indy 10) yet?

> How can I prevent that?

It is not an error to begin with.  It is normal behavior.  Simply don't try
to keep accessing the connection after it has been closed.  If the exception
is happening in a server, then simply ignore it.  The server component will
handle it.  If the exception is happening in a client, then you have to
handle the exception yourself with a try..except block.

Gambit

Replies

None

In response to

Connection closed Gracefully posted by Feijó on Thu, 28 Sep 2006