The following needs to happen (in the background) before you call send(). 1. The connect() establishes the tcp connection to the subscriber 2. The subscriber sends its subscription string to the publisher (filtering is pub side on all protocols apart from PGM)
If send() happens before this the pub socket will just throw away the message as it sees there are no subscribers. If you want to know when a subscription message has arrived on the publisher switch to XPUB and poll the socket for incoming messages. On Tue, Aug 27, 2019 at 9:05 AM Arnaud Loonstra <[email protected]> wrote: > I think you are dealing with the slow subscriber problem: > > http://zguide.zeromq.org/page:all#toc117 > > Rg, > > Arnaud > > On 27-08-2019 09:52, Tomaz Beltram wrote: > > Hi, > > > > I use pub/sub pattern to deliver events and have noticed that some > > messages get lost. I make sure that subscriber binds to the socket and > > waits in recv() before the publisher sends the event. I was able to > > reproduce this issue when the publisher calls send() immediately after > > connect(). If there is a 1ms sleep in between two calls the message is > > received. Sample code is here: https://pastebin.com/TjUtfFgp > > > > Is this expected behaviour, bug or am I missing some important socket > > options? > > > > The OS is Ubuntu 18.04 with libzmq5. > > > > wbr Tomaz > > > > _______________________________________________ > > zeromq-dev mailing list > > [email protected] > > https://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > https://lists.zeromq.org/mailman/listinfo/zeromq-dev >
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
