Re: Connection closed Gracefully

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

"Feijó" <fei…> wrote in message

> 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.




In response to

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