[email protected] said: > I have run into this many times. The issue is that the SUB socket > doesn't get the messages until it actually connects: > > If the PUB starts before the SUB, the PUB will start broadcasting > before the SUB starts and the SUB won't get those messages that were > sent before the SUB connects. A PUB socket is like a radio broadcast. > If you aren't listening, you don't get the messages. > > BUT (this is more subtle). If the SUB starts before the PUB, you will > still miss messages. This is because it takes a little bit of time (I > think 0.1 sec) for the SUB socket to realize the PUB socket has > started. In that short time interval, the PUB socket has already > started sending and you miss a few.
This should be a non-issue in the simple case where a user starts the subscriber (process b in the example) 1st, then switches to another window and starts the publisher (process a) 2nd. There is a more subtle thing going on here though which is that in process a zmq_send() is async so this just means "queue for sending". If you queue quicker than the *actual* send to the network happens and call zmq_term() you will lose outstanding data. There's no real solution to this right now except adding a sleep(100) in the publisher, or as Brian says using some other way to synchronize "Start of data" and "End of data". -mato _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
