[Twisted-Python] Setting socket options before bind/listen

Tobias Oberstein tobias.oberstein at tavendo.de
Mon Feb 3 13:41:10 MST 2014


Hi,

for a multiprocess server, I'd like to set SO_REUSEPORT on a TCP listening socket.

The option needs to be set _before_ calling bind() and listen() on the socket.

Is there a recommended way of doing this?

One option might be subclassing `twisted.internet.tcp.Port` and overriding `createInternetSocket` - is that recommended?

And if so: how do I make the CustomPort be used with reactor.listenTCP/listenSSL and endpoints?

Any hints appreciated, thanks!

/Tobias



More information about the Twisted-Python mailing list