[zeromq-dev] first message never received when SUB binds (0MQ 3)

MinRK benjaminrk at gmail.com
Sun Sep 4 20:47:58 CEST 2011


When binding with SUB, and connecting with PUB, it seems impossible to
receive the first message.

Failing example (Python):

import zmq
ctx = zmq.Context()
pub = ctx.socket(zmq.PUB)
sub = ctx.socket(zmq.SUB)
sub.bind('tcp://127.0.0.1:5555')
sub.setsockopt(zmq.SUBSCRIBE, '')
# sleeping here makes no difference
pub.connect('tcp://127.0.0.1:5555')
# sleeping here makes no difference

pub.send('hi')
sub.recv() # never arrives

all subsequent messages behave as expected, and the first message arrives as
expected when the bind/connect is reversed.

This is new behavior in 3.0. The first message arrives just fine in 2.x.

-MinRK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110904/2b1860f6/attachment.htm>


More information about the zeromq-dev mailing list