[Twisted-Python] Custom transports

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

On Thu, 2005-12-22 at 18:34 -0500, Adam Atlas wrote:
> Hello,
> What would I do to implement a custom transport within the Twisted  
> framework? That is, I'd like to be able to add custom listen___ and  
> connect___ methods to the reactor, so that existing protocols can run  
> over a new backend transport protocol. What API would I use for this?

If this transport is implemented in terms of other protocols, it doesn't
have to be a reactor method. For example, lets say you write a SOCKSv4
transport; the way users would use it is probably:

mySocksProxy = SOCKSProxy('myproxy.example.com', 9999)
mySocksProxy.listenTCP(8080, SomeFactory())

Even if it requires registering file descriptors, you don't *have* to
add reactor.* methods (see e.g. twisted.internet.stdio).

More information about the Twisted-Python mailing list