[zeromq-dev] Is Pub/Sub unreliable

gonzalo diethelm gdiethelm at dcv.cl
Wed Mar 10 13:54:49 CET 2010

> > But I run the receiver first, THEN run the sender (sorry if that was
> > clear). In that case, shouldn't the receiver get ALL messages sent
> > the sender?
> It takes some time to connect. Thus when you start the sender, it'll
> bind to an interface a starts sending messages. In say 50us receiver
> connects and starts receiving messages. However, in the meantime
> may have already broadcasted all the messages.

Here is what I did:

# On window 1:
# receive 20 messages
./receiver tcp:// 20
# the app is waiting on a recv() call

# wait for a couple of seconds...

# On window 2:
# send 20 msgs, waiting 50 ms between them, no poll
./sender tcp:// 20 50 0

But now sender sleeps after binding to the PUB socket and before it
starts sending messages. There are two cases happening here:

1. If the sender sleeps any amount of ms above 100, the receiver gets
all messages.

2. If the sender sleeps, say, 50 ms, the receiver misses a few of the
initial messages sent by sender.

If this is by design, that's fine; I could always add a small sleep time
after binding to a PUB socket. But what I don't understand is this: why
do I need any sleeping time at all, if the receiver started first and
its SUB socket has been idling for a couple of seconds?

The only explanation I can find is that, although the SUB socket is
ready, it still needs to do some processing when it is notified that the
corresponding PUB socket came alive; while it is doing that processing,
the sender has already sent some messages. Is this the case?

Gonzalo Diethelm

Declaración de confidencialidad: Este Mensaje esta destinado para
el uso de la o las personas o entidades a quien ha sido dirigido y
puede contener información reservada y confidencial que no puede
ser divulgada, difundida, ni aprovechada en forma alguna. El uso no
autorizado de la información contenida en este correo podrá ser
sancionado de conformidad con la ley chilena. 
Si usted ha recibido este correo electrónico por error, le pedimos
eliminarlo junto con los archivos adjuntos y avisar inmediatamente
al remitente, respondiendo este mensaje. 

"Before printing this e-mail think if is really necesary".
Disclosure: This Message is to be used by the individual,
individuals or entities that it is addressed to and may include
private and confidential information that may not be disclosed,
made public nor used in any way at all. Unauthorized use of the
information in this electronic mail message may be subject to the
penalties set forth by Chilean law. 
If you have received this electronic mail message in error, we ask
you to destroy the message and its attached file(s) and to
immediately notify the sender by answering this message. 

More information about the zeromq-dev mailing list