[Twisted-Python] best way to turn on SO_KEEPALIVE option on all sockets

Itamar Shtull-Trauring itamar at itamarst.org
Fri Feb 11 11:01:38 EST 2005


On Thu, 2005-02-10 at 18:22 -0800, Alec Matusis wrote:

> I was wondering what is the best way to turn on KEEPALIVE option on all
> sockets opened by my twisted server.

In your Protocol's connectionMade do
self.transport.setTCPKeepAlive(True)

http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.ITCPTransport.html is the documentation for the TCP transport's interface.





More information about the Twisted-Python mailing list