Rsvay
Rsvay

Reputation: 1445

In which manner zeroMQ read form multiple connections?

I want to know in which manner zeroMQ read form multiple connections ?

For example:

Upvotes: 1

Views: 246

Answers (1)

ajsp
ajsp

Reputation: 2670

Use pub-sub routine, Python example:

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

Upvotes: 1

Related Questions