1.注册socket到poller中

poller = zmq.Poller()
poller.register(frontend, zmq.POLLIN) # receive worker message
poller.register(receiver, zmq.POLLIN) # put message to client

2.接受消息时依据socket标识来判断是该哪个socket接受消息

while True:
if socks.get(frontend) == zmq.POLLIN:
frontend.recv_multipart() if socks.get(receiver) == zmq.POLLIN:
receiver.recv_multipart()
05-11 20:42