[Twisted-Python] How to make a custom transport based on sendmsg/recvmsg?
phil-twisted at tuxeo.org
Fri Feb 22 14:54:30 EST 2008
I would like to make a custom protocol, based on Unix sockets, that is
able to send and receive file descriptors in addition to regular
At the low level, I can do this with a patched version of eunuchs, that
adds sendmsg() and recvmsg() functionality to python.
I have tried to find my way in the Twisted API documentation and in the
sources, and as far as I found out, I have to override the doWrite()
method of the abstract.FileDescriptor class, and the doRead() method of
one of its subclasses.
The only way I have found until now is to do this in the Protocol
subclass like this:
sendmsg(self.transport.socket.fileno(), data, ancillary=ancillary)
(data, dummy, dummy, ancillary) =
.... # process tlv object
def sendtlv(self, tlv):
Some of the return values are not completed yet (EOF, ...).
Am I completely on the wrong track here ?
If not, what other methods of self.transport do I need to override ?
If yes, what is the correct way to do this ?
More information about the Twisted-Python