[zeromq-dev] how to reliably wait for SUBscribers to connect before sending messages

Francesco francesco.montorsi at gmail.com
Fri Jan 5 12:33:47 CET 2018


Hi Luca,

2018-01-05 12:23 GMT+01:00 Luca Boccassi <luca.boccassi at gmail.com>:

> On Fri, 2018-01-05 at 12:04 +0100, Francesco wrote:
> > Question for zmq developers: would be possible to add a new event to
> > the
> > socket monitor interface that tells you when the SUB side has
> > _really_
> > connected and is for sure ready to receive messages?
>
> Use XPUB - it will deliver the subscription message to the pub socket.
>
> You mean that I can avoid to sleep() if I use an XPUB socket instead of
PUB and do:
 - zmq_bind(),
 - zmq_msg_recv() (waiting to receive a 1byte message)
 - zmq_msg_send()
and the SUB socket will surely receive the same number of messages sent on
the XPUB side?

That would be a solution even if at my stage of development changing from
PUB to XPUB may have side effects I cannot easily understand right now...

Thanks,
Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180105/66329439/attachment.htm>


More information about the zeromq-dev mailing list