using twisted as a client-server hybrid

Chris Angelico rosuav at gmail.com
Thu Dec 15 02:34:22 EST 2011


On Thu, Dec 15, 2011 at 6:14 PM, Littlefield, Tyler <tyler at tysdomain.com> wrote:
> Hello all:
> I have a quick question--I am working on a project where a system will
> connect to me to get commands. The idea is to make the server the "client,"
> used for dispatching commands, so  I'm trying to find a way that I can set
> it up to listen, but poll stdin somehow for input. Is this a possibility?

One easy way to do that is to use separate threads, one to watch stdin
(preferably the main thread) and one to listen on the socket or
whatever the other end uses. Another option is to use async calls and
callbacks. But to answer your simplest question, yes, it most
definitely is.

ChrisA



More information about the Python-list mailing list