[zeromq-dev] Is Pub/Sub unreliable

Emit Sorrels emit.sorrels at gmail.com
Wed Mar 10 04:24:46 CET 2010

On Tue, Mar 09, 2010 at 07:26:34PM -0300, gonzalo diethelm wrote:
> I wrote two small apps: one binds a PUB socket to an endpoint and sends
> N messages to it; the other connects a SUB socket to that same endpoint
> and receives N messages. The sender optionally can wait a certain amount
> of ms between each send, and it always waits for 60 seconds at the end.
> I am attaching both files; all my tests are under Windows XP.
> I run the following commands on two separate windows:
> # send 20 msgs, waiting 50 ms between them, no poll
> ./sender tcp:// 20 50 0
> # receive 20 messages
> ./receiver tcp:// 20
> This works erratically. Sometimes receiver receives less than 20
> messages; sometimes it receives NONE.
> Is it the case that PUB/SUB sockets are unreliable? This is sort of a
> surprise to me... If they are not, what could explain this behavior?
> Thanks in advance.

if a tree falls in the forest and no one is there to hear it does
it make a sound? :P

afaik, pub doesn't queue up all the messages you send and resend
old messages to subs that connect later on. it isn't used for
such a use case.


More information about the zeromq-dev mailing list