[Twisted-Python] Integrate other API that uses select

Itamar Shtull-Trauring itamar at itamarst.org
Fri Dec 23 13:48:38 EST 2005


On Fri, 2005-12-23 at 14:23 +0100, Wolfgang Eichler wrote:

> 
> I would like to integrate another c-api, that uses select ( for some tcp - connection ); 
> 
> If I could extend this c-api, to question for the bit-arry it uses for
> the select, could I enter this in the twisted framework to get the
> control, if some event for these sockets are coming in and then
> notifiy the  c-api to handle the events on his sockets.

Yep - reactor.addReader and reactor.addWriter let you register file
descriptors; typically the object you register would be an instance of a
subclass of twisted.internet.abstract.FileDescriptor.

Well designed C APIs will expose the underlying parsing code in addition
to a TCP-specific implementation, and it'd be better to wrap this. 





More information about the Twisted-Python mailing list