Is it possible to use zmq.Poller
to also poll for data availability on stdin? If not, what would be the most efficient wait to poll, at the some time (ideally), for data availability on zeromq sockets & stdin?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
yes, zmq pollers do support native FDs, including stdin, etc., so you just need to check
sys.stdin.fileno()
:If you are sure you will never run on Windows, you can simply register
sys.stdin
with azmq.Poller
(as described by minrk, above).However, the
select()
implementation in Winsock only supports sockets and cannot be used to poll "regular" file descriptors like the standard input. Therefore, when running on Windows, you need to bridge the standard input with a 0MQ socket on the inproc transport.Suggested implementation using an exclusive pair socket: