我想知道zeroMQ从哪种方式读取多个连接?
例如:
答案 0 :(得分:1)
使用pub-sub例程,Python示例:
#Publishing script
import zmq
ctx = zmq.Context()
socket_publish = ctx.socket(zmq.PUB)
socket_publish.bind("tcp://*:7787") #define socket for publishing
#subscribing script(s)
ctx = zmq.Context()
s = ctx.socket(zmq.SUB)
s.connect("tcp://127.0.0.1:7787") #connect to the socket multiple times
s.setsockopt(zmq.SUBSCRIBE,'')
msg = s.recv()