[Twisted-Python] How to hook at StandardIO factory to a twistd app
Itamar Shtull-Trauring
itamar at itamarst.org
Wed Apr 8 16:19:36 EDT 2009
> Hi Twisted!
>
> Could a kind soul provide me an example of how to connect my StandardIO
> factory to a twistd app? Here is an overview of my code
>
> class MyProtocol(basic.LineReceiver):
> # Blah Blah
>
> class MyFactory( stdio.StandardIO ):
> def __init__(self, protocol):
> self.protocol = protocol
You should not subclass StandardIO, nor do you need a factory. You just do
"stdio = StandardIO(protocolInstance)" and then keep that reference
around.
> It is not clear to me how to connect my factory to the application, I do
> this many other times for network related factories by connecting via a
> TCPServer or TCPClient .
Write a custom service, with a startService that creates a StandardIO
instance and shuts it down in stopService.
More information about the Twisted-Python
mailing list