其他分享
首页 > 其他分享> > zmq Poller

zmq Poller

作者:互联网

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()

 

标签:frontend,socket,Poller,POLLIN,receiver,zmq,poller
来源: https://www.cnblogs.com/callyblog/p/10396933.html