[Twisted-Python] TCP KeepAlive

Andrea Arcangeli andrea at cpushare.com
Mon Oct 3 18:55:13 EDT 2005

On Sun, Oct 02, 2005 at 12:18:56PM -0700, Brian Warner wrote:
> more commonly, a NAT box which has forgotten about the connection because it
> hasn't sent any traffic for 10 or 20 minutes). If the connection is busy,

I had to deal with this problem too, but my solution has been to tweak
the tcp stack so it keeps the nat alive with these settings:

+++ /etc/sysctl.conf	2005-04-08 05:39:46.106935468 +0200
+net.ipv4.tcp_keepalive_time = 240

This way a keepalive packet is sent every 4 min.

This is way simpler and more efficient (lower internet overhead too!)
than doing it in userland.

More information about the Twisted-Python mailing list