[Twisted-Python] Setting socket options before connect

Phil Mayers p.mayers at imperial.ac.uk
Fri Jul 12 04:25:51 MDT 2013


I have a use case (namely setting the Linux-specific SO_MARK socket 
option) where I need to set the socket option after the socket object is 
created but before Twisted starts to try and connect.

Is there a clean way to do this? Ideally there would be some sort of 
pre-connect function, similar to the preexec_fn for child processes, but 
any reasonably clean solution will do.

(By clean I mean "doesn't have me duplicating hundreds of lines of 
Twisted code into my own Connector/Port/etc. classes" ;o)



More information about the Twisted-Python mailing list