[Twisted-Python] Triggering callbacks on raw file descriptors

Brian Granger bgranger at scu.edu
Sat Jan 7 13:14:26 EST 2006


I am trying to integrate an external networking library that is  
asynchronous into a Twisted app (Apple's Bonjour for those  
interested).  The library is setup for use in a select loop.  The  
library is responsible for all the actual network things (like  
creating the connection, reading and writing to it.  The only thing I  
need to do is register the socket's file descriptor with the twisted  
reactor and have some callback triggered when it is _ready_ for  

Digging around the source code, it looks like the FileDescriptor that  
Port inherits from would be a good starting point.  But as I  
understand it FileDescriptor is abstract.  Is it as simple as  
inheriting from FileDescriptor and providing the fd that I get from  
Bonjour?  How do I specify callbacks to trigger when the fd is  

Anything I am missing in this picture.

I will gladly share my code if I get Apple's Bonjour implementation  
working with twisted.



More information about the Twisted-Python mailing list