[Twisted-Python] Wiring a new reactor/Client into Twisted

Itamar Shtull-Trauring itamar at itamarst.org
Wed Jul 28 10:29:57 EDT 2004

On Tue, 2004-07-27 at 16:35, Eugene Coetzee wrote:

> According to the howto's 
> (www.twistedmatrix.com/documents/current/howto/tutorial/intro) the 
> 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. 

You can do that without a factory. The factory is really there to
*create* instances - which is not relevant e.g. for UDP and thus UDP has
no factories, even though UDP may require an abstraction layer. There's
nothing preventing you from writing your own layer.

> 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)

UDPClient is very different from TCPClient (and deprecated, btw). A
single UDPClient has one protocol instance and listens on one UDP port.
Likewise, a SerialClient would only be connected to one serial port. If
you want something beyond that you'd need to build another layer on top
of that, and this layer probably would be specific to your application
and not a generic one.

Itamar Shtull-Trauring    http://itamarst.org

More information about the Twisted-Python mailing list