[Twisted-Python] Triggering callbacks on raw file descriptors

Itamar Shtull-Trauring itamar at itamarst.org
Sat Jan 7 13:46:48 EST 2006

On Sat, 2006-01-07 at 10:14 -0800, Brian Granger wrote:

> 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  
> readable/writable?


You just need a fileno() method that returns the file descriptor you are
wrapping, and doRead and doWrite methods that they do the appropriate
thing (they will get called by the reactor on those events.)

More information about the Twisted-Python mailing list