[Twisted-Python] getting sshsimpleserver.py to work within a wrapper

Jean-Paul Calderone exarkun at divmod.com
Tue Mar 10 18:00:10 EDT 2009


On Tue, 10 Mar 2009 22:45:03 +0100, jkv <jkv at unixcluster.dk> wrote:
>Ben Hyde wrote:
>>In  one of the examples (sshsimpleserver.py) reactor.listenTCP is used to 
>>listen on the network socket, as far as i can read from the twisted core 
>>documentation there are no builtin way to make reactor.listen* listen on 
>>stdin instead... Any hints?
>>
>>Take look at twisted.internet.stdio.StandardIO.
>>
>>I'm new to this twisted stuff, so no doubt I've gotten this a bit wrong... 
>>but:
>>
>>But, the act of listening is primarily about waiting for a new connection 
>>etc.; since standard io is already connected it doesn't quite make sense to 
>>listen for it.
>>
>>When a listener L awakens for a new connection it cobbles together the 
>>plumbing necessary to manage the connection.  That plumbing will invoke the 
>>methods of an object C responsible for handling the connection.  The 
>>listener L creates the object P, one for each connection, by via the 
>>factory object F it was given when L was created.  It is the responsibility 
>>of C to implement protocol appropriate to the connection.
>>
>>What twisted.internet.stdio.StandardIO provides is a very simple protocol 
>>for standard IO.
>Hi Ben,
>
>Thank for the information, i have been looking into 
>twisted.internet.stdio.StandardIO, and it seems that what i want it possible 
>with twisted.
>
>Would anyone on this list be able to point me to some code examples where a 
>twisted.protocol is connected to stdio instead of a network socket?

http://twistedmatrix.com/projects/core/documentation/examples/ includes a
couple examples of using stdio, `stdiodemo.py´ and `stdin.py´.

Jean-Paul




More information about the Twisted-Python mailing list