[Twisted-Python] Missing feature in detecting stalled PB connections?

Uwe C. Schroeder uwe at oss4u.com
Tue Feb 21 22:12:27 EST 2006

On Tuesday 21 February 2006 09:58, Itamar Shtull-Trauring wrote:
> On Tue, 2006-02-21 at 18:40 +0100, Luc Stepniewski wrote:
> > On Tuesday 21 February 2006 17:06, Itamar Shtull-Trauring wrote:
> > > The typical way to do this is have some sort of remote_ping method that
> > > returns immediately on the server (or on the client) that the client
> > > (or the server) calls every once in a while, with a timeout for the
> > > response. If that times out the problem is likely the connection, not
> > > the server being slow, in which case you can close the connection.
> >
> > Yes, it's the same thing as making a pseudo "timeout" with a callLater.
> Not exactly. What I'm suggesting is a different command that you send in
> addition to your regular operations. This extra command, "ping", is
> expected to return a result quickly; if it doesn't you know something is
> wrong. That way even if your regular commands take a really long time
> for the server to process you can still tell if the server itself (or
> your connection to it) is ok. Every 10 seconds, say, you ping the
> server; if you don't get a response back in 5 seconds it's probably
> down.

That's actually what I'm doing with my application - although for a different 
reason. I send a "ping" that immediate is answered by a "pong" - if I don't 
get the pong withing 30 seconds I shut the connection down.
My reason is a missconfigured firewall at one of my clients which drops 
forwarding after about 90 seconds idle time. Since I couldn't get their 
(incompetent) network admin to fix it I send a ping every 30 sec, so the 
firewall thinks the connection is active and doesn't drop it.

Luc: if you need the code for that (although it's very simple), drop me a 


Open Source Solutions 4U, LLC	1618 Kelly St
Phone:  +1 707 568 3056		Santa Rosa, CA 95401
Cell:   +1 650 302 2405		United States
Fax:    +1 707 568 6416

More information about the Twisted-Python mailing list