[Twisted-Python] Cancel a Deferred timeout

Thomas Heller theller at python.net
Wed Feb 12 09:21:51 MST 2003


I'm currently doing my first steps with twisted, and I have a
question.

I've started hacking the EchoClient example to connect to a small
embedded TCP server with a custom protocol I have here.

The server sends a line-feed 3 times a second, and when the client
doesn't receive them for one second or more, it must assume the
connection is broken and it should close the connection immediately
(and try to reconnect).

I thought using a deferred for this with a timeout of one second,
which will close the connection if the timeout callback is called.  If
the line-feed is received, the deferred timeout must be canceled, and
a fresh one set up. How can I do this?

Thanks,

Thomas





More information about the Twisted-Python mailing list