[Twisted-Python] Connection close identifier

Itamar Shtull-Trauring itamar at itamarst.org
Wed Apr 7 11:35:44 EDT 2004


On Wed, 2004-04-07 at 11:02, Daniel Henrique Debonzi wrote:

> I have a server-client system where sometimes the server closes the 
> connection and sometimes client closes connection.
> In each situation I must do diferent things.

Seems like a bad idea to me (like, if TCP connection doesn't close
cleanly, do both sides think the other side closed? or what?). Better to
indicate this information on protocol level.

But if you must... In Twisted, what I'd do is have protocols remember
whether or not they did transport.loseConnection(), and thus they can
tell whether or not they were responsible for connectionLost event they
got.

-- 
Itamar Shtull-Trauring    http://itamarst.org
Looking for a job -- http://itamarst.org/resume.html





More information about the Twisted-Python mailing list