[Twisted-Python] twisted gprs

Carl Zmola zmola at acm.org
Wed Jan 9 19:06:20 EST 2008

John Aherne wrote:
> Is there any call I can make use of to be able to detect the failed send
> before the connection finally is broken.
In general, there is no way to know if a connection is broken.
The standard way to do this is to send a heartbeat message every x 
seconds if there is no other communication on the connection.
On the server, you keep a watchdog timer and wait 2x seconds.  You reset 
the timer on every communication.
This can be tuned as you see fit, but it has to be done in your application.

The trade off is that if you want to know instantly that a connection is 
down, you need to be sending data constantly.

Carson suggested some ways to tweek TCP, and if you have control of the 
TCP stack, it is tweakable, but it is not portable.

zmola at acm.org

More information about the Twisted-Python mailing list