Bosnjak Zoran ITWEP <Bosnjak@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@couter.dropbear.id.au Debian Developer | mailto:eddie@debian.org | jabber:sam@teknohaus.dyndns.org OpenPGP fingerprint: A46B 9BB5 3148 7BEA 1F05 5BD5 8530 03AE DE89 C75C