Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Sep : Re: TIDTCPServer OnExecute continues after Client disconnect using Indy 10 and

www.cryer.info
Managed Newsgroup Archive

Re: TIDTCPServer OnExecute continues after Client disconnect using Indy 10 and

Subject:Re: TIDTCPServer OnExecute continues after Client disconnect using Indy 10 and
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Wed, 12 Sep 2007 17:47:32

"Toby Piper" <news@CompCraft.com> wrote in message
news:46e86a75$1@newsgroups.borland.com...

> Sometimes the server thread (OnExecute) method is continued
> to be called after the Client has disconnected.

It is supposed to.

> This raises an exception when it tries to readln again and the
> exception message is 'Connection Closed Gracefully.'

That is perfectly normal behavior.  That is how Indy is designed to work.
It makes heavy use of exceptions as notifications to itself.

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

That is also part of Indy's design.  A connection is not considered closed
if its InputBuffer can still satisfy reading operations.  As soon as a
reading operation needs to access the socket again, the disconnect is
handled and an exception is raised.

> Also how do I clear the inputbuffer if I need to?

The InputBuffer is a public property of the connection, and has a Clear()
method.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive