简体   繁体   中英

Twisted Reactor for client-side python interface / raw_input

I am using twisted to run a rather complicated server that allows for data collection, communication, and commanding of a hardware device remotely. On the client-side there are a number of data retrieval and command operations available. Typically I use the wxpython reactor to interface with the client reactor, but I would also like to setup a simpler command-line style interface.

Is there a reactor that I can use to setup a local non-blocking python-like or raw_input -style interface for the client? After successful access to the server, the server will occasionally send data down without being requested as a result of server-side events.

I have considered manhole , but I am not interested in accessing the server as an interface, I am strictly interested in accessing the client-side data and commands. This is mostly for debugging, but it can also come in handy for creating a much more rudimentary client interface when needed.

See the stdin.py and stdiodemo.py examples , I think that's similar to what you're aiming for. They demonstrate connecting a protocol (like a LineReceiver ) to StandardIO .

I think you could also use a StandardIOEndpoint (and maybe we should update the examples for that), but that doesn't change the way you'd write your protocol.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM