[zeromq-dev] zmq_socket_monitor Issue

Mark Studenka mstudenka at perseus.co
Tue Dec 8 06:27:42 CET 2015

I'm seeing some weirdness that I believe is related to a
zmq_socket_monitor.  It seems that if I create a socket monitor and attach
it to a REP socket and then *also* join a multicast group with a SUB
socket, I never receive any callbacks on the socket monitor.

Here's the basic gist of what I have and what I'm trying to do.  I have a
server with a REP socket and a PUB socket.  Clients connect a REQ to the
REP socket and send requests and such and also join a multicast on a SUB
socket connected to the server PUB.  I'm attempting to put a socket monitor
on the REQ socket to only send requests if the socket has been connected.

The weird thing is that separately, all the code works.  The socket monitor
and REQ socket work just fine.  The SUB socket works just fine.  But when
it's all together, the SUB socket seems to block the socket monitor or REQ
socket from working properly.

I've put some basic client code in a pastebin that re-creates the issue and
helps explain what I'm trying to do.  http://pastebin.com/tHa4eBxy  This
code can be run three ways:

1.  Just the REQ socket and socket monitor.  The socket connects and the
socket monitor reports the connection properly.
2.  Just the SUB socket.  The socket joins the multicast and I receive
multicast traffic.
3.  Both scenarios combined, the socket monitor never reports the REQ
socket as completing.  Using netstat I can see that the connection is

I'm curious if someone can look at the example code I have and let me know
if there's something that looks wrong.  I've tried multiple variations to
make things work.  Everything I try it seems that the SUB socket is
interfering with the socket monitor or REQ socket in some way.  The posted
code is simply the most basic thing I've found that shows the issue I'm

Any help or tips would be appreciated.  If my sample code looks ok I'll
start digging down into the ZeroMQ code a little more to try to track down
what could be happening.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20151207/3df69683/attachment.htm>

More information about the zeromq-dev mailing list