[Twisted-Python] reconnecting from the client
sam at couter.dropbear.id.au
Mon Jul 26 20:49:03 EDT 2004
Bosnjak Zoran ITWEP <Bosnjak at iskratel.si> wrote:
> 3. If the connection is active and no data can be transmited / received for X seconds (link down, router down),
> the client should try to reconnect as in the case (1.) (as if the client has never been connected)
> It should react in less then 10 seconds.
> Unfortunately I can not detect the situation (3.). If I unplug the ethernet while connected, none of my methods is called (ever).
> I couldn't find anything like this in the documentation or in the examples.
This isn't a Twisted thing, it's a TCP thing. When you unplug your
ethernet cable, packets start to silently fall on the floor. It's only
after the TCP layer times out without seeing expected ACK packets that
it'll consider the connection lost. Up until that point, it just thinks
the connection has high latency that's getting higher all the time.
The TCP timeout is often set at several minutes. If you want a ten
second response to lost packets, you should implement some kind of ping
and/or timeout mechanism yourself, on top of TCP.
A router busted in the appropriate way will send ICMP host unreachable
or network unreachable messages, and the TCP layer will be able to
immediately detect a connection broken in this way.
Your operating system may provide a way of tuning TCP connection
parameters, in which case you may be able to get the TCP timeout down to
ten seconds. Expect lots of broken connections. I'm not sure if that
would violate the various TCP RFCs either.
Sam "Eddie" Couter | mailto:sam at couter.dropbear.id.au
Debian Developer | mailto:eddie at debian.org
| jabber:sam at teknohaus.dyndns.org
OpenPGP fingerprint: A46B 9BB5 3148 7BEA 1F05 5BD5 8530 03AE DE89 C75C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040727/d4cfa354/attachment.pgp
More information about the Twisted-Python