[Twisted-Python] best way to turn on SO_KEEPALIVE option on all sockets
Alec Matusis
matusis at matusis.com
Thu Feb 10 19:22:56 MST 2005
Hello,
I was wondering what is the best way to turn on KEEPALIVE option on all
sockets opened by my twisted server.
I have inserted s.setsockopt(socket.SOL_SOCKET,socket.SO_KEEPALIVE,1) line
into twisted/internet/base.py
class BasePort(abstract.FileDescriptor):
"""Basic implementation of a ListeningPort."""
addressFamily = None
socketType = None
def createInternetSocket(self):
s = socket.socket(self.addressFamily, self.socketType)
s.setblocking(0)
++ s.setsockopt(socket.SOL_SOCKET,socket.SO_KEEPALIVE,1)
but I am wondering if there is a better way of doing this, without actually
modyfying twsited code...
Thanks
Alec Matusis.
More information about the Twisted-Python
mailing list