[zeromq-dev] REQ to many REP.

Riskybiz riskybizlive at live.com
Mon Jun 23 22:24:56 CEST 2014

I'd like to set up a 0MQ  REQ-REP arrangement where there are many REP
sockets connected to just one REQ socket.  The actual number of REP sockets
is unknown at design-time; however at run-time a list of the port addresses
will be provided to the code running the REQ socket.


What I'd like is that, somehow, the code running the solitary REQ socket
will loop through the list of port addresses and connect to the multiple REP
sockets as they bind and become available.  Subsequently the REQ socket
would work with (poll??) the established connections to send and receive
messages as necessary.


It's the first time I've tried this.  Looking at the zmq_poll reference in
the manual http://api.zeromq.org/3-2:zmq-poll it's unclear to me whether I
can handle variable number of connections in an iterative manner.  For
example in: http://zguide.zeromq.org/cpp:mspoller the poll set is hard


Another question is can a REQ socket handle multiple connections?  How best
could a message be routed to the desired destination REP socket?  Is some
more advanced pattern necessary here ROUTER, BROKER??


What I'm trying to achieve is a REQ-REP flow to act as a command/control
layer which will coordinate a PUSH-PULL socket pair. There will be a
run-time flexible number of PUSH sockets but always just one PULL socket.


Is anyone able to offer any guidance to clear my muddy thoughts on how to
make this work? Am coding in C++.


With thanks,



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140623/216c32e5/attachment.htm>

More information about the zeromq-dev mailing list