[Twisted-Python] Dual Reactor Script
Mark Evans
v6kk1hg02 at sneakemail.com
Wed Oct 29 15:26:42 MST 2003
This question pertains to the use of dual reactors in a
single Python script. The script runs on Windows 2000 and
has the nature of a daemon which translates between two
protocols on either side of it.
Side A = Telnet protocol ("raw" type)
over TCP transport to embedded device
ASCII data
Side B = Custom binary protocol (bits, bytes)
over UDP transport
binary data
Now the Twisted Matrix samples I've examined all do this
in their main entry:
reactor.listenTransport(port, protocolFactory)
reactor.run()
However I have TWO transports and TWO protocols. So the
question is how to properly configure the reactor(s) in my
script. Any advice, in particular? How should such a
daemon be structured properly in TM? Threads? Two
scripts? Please advise. I'm sure there's a simple way
but always like to cover my bases with the gurus. Probably
I need only one reactor, configured in a particular way to
handle two protocols and transports.
Thanks!
Mark
More information about the Twisted-Python
mailing list