[zeromq-dev] SUB and PUB sockets on one url over epgm/pgm

Arnaud Loonstra arnaud at sphaero.org
Mon May 11 16:04:24 CEST 2015

On 2015-05-11 15:53, Sergey Zinov wrote:
> Hi all,
> I encountered problem, while using zeromq with epgm transport.
> I have several nodes that should broadcast messages to each other,
> for that purpose each node creates two sockets(one PUB and one SUB)
> with same url. See attachment for sample code(python).
> First I tested it on amd64 linux server, and it worked as I expected.
> Each nodes can send and receive messages.
> But then I tried it on ARM board, and it worked only
> occasionally(something like 1 of 10 runs). I also tried to run it on
> virtual machines, and sometimes observe such misbehavior there(but it
> works most of the time). So it seems there is some connection between
> performance of machine and this bug.
> After some days of tries, I found out, that if I do
> 'setsockopt(zmq.SUBSCRIBE, "")' for subscriber socket before I bind
> publisher socket, it works, otherwise described behavior is observed.
> With this 'fix' it seems to be working fine. But definitely something
> is wrong here, and I'm not sure how robust this solution is. I'm not
> really sure if it is a bug in zeromq at all - maybe I'm trying to use
> zmq wrong way. Can anybody tell if there is better solution for my
> case?
> Best regards,
> Sergey

I'm not sure but I thought you always must set a subscribe option to a 
pub/sub socket.

Also note this:
 From ZeroMQ v3.x, filtering happens at the publisher side when using a 
connected protocol (tcp:// or ipc://). Using the epgm:// protocol, 
filtering happens at the subscriber side. In ZeroMQ v2.x, all filtering 
happened at the subscriber side.



More information about the zeromq-dev mailing list