I have a thread that waits for signaling input via ZMQ and Network IO via TCP ( and another doing the same with UDP ).
socket_tcp = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
socket_tcp.connect( ( self.config.tcp_ip, self.config.tcp_port ) )
while True:
s_ready = zmq.select( [socket_zmq, socket_tcp], [], [] )[0]
for sock in s_ready:
# do stuff
However, the TCP socket is never returned as writable ( I made sure it actually gets data using Wireshark ).
The Documentation says I could pass
A
zmq.Socket
or any Python object having afileno()
method that returns a valid file descriptor.
and I guess the later is true for socket.socket
.
Its the same with UDP.
Am I missing something?
Do I need to handle the ZMQ socket in a separate thread and pass its messages over using ctrl_rcv, ctrl_snd = multiprocessing.Pipe()
?
Or can I use a select
over both worlds, as I would expect?