[Twisted-Python] Wiring a new reactor/Client into Twisted
projects at reedflute.com
Tue Jul 27 16:35:20 EDT 2004
Itamar Shtull-Trauring wrote:
>On Mon, 2004-07-26 at 18:05, Eugene Coetzee wrote:
>>I'm already using SerialPort from twisted.internet.serial but I want to
>>wire it so that it works like the rest of a typical Twisted app with a
>>factory container and reactor like event loop.
>1. It doesn't require a factory because that wouldn't make sense in the
>context, just like twisted's udp support doesn't require a factory.
Thanks for your feedback on this question.
According to the howto's
factory is useful because it allows you to separate the database code
from the protocol implementation. In other words you are adding an
abstraction layer to separate concerns - something that I would also
like to do. In the scenario of a Modbus implementation - there is also a
Modbus implementation for ethernet i.e. Modbus RTU versus Modbus serial
>2. It requires the reactor event loop to be running in order to work.
I would rephrase what I'm trying to do as follows : I want an
application with a single event loop and abstraction layer so that I can
handle TCP/UDP/serial/you-name-it type of protocols transparently. I
also want a container into which I can plug multiple and different kind
of protocols as described at
www.twistedmatrix.com/documents/current/howto/tutorial/factory under the
heading "using a single factory for multiple protocols"
In order to achieve this I need to extend SerialProtocol from
twisted.serial but it is clear that I need to do much more than just
that. This is where I have difficulty in in extending the functionality
of twisted.application.internet to build something which I can refer to
as "SerialClient" (analogous to TCPClient,UDPClient)
Web -> www.reedflute.com
More information about the Twisted-Python