Message not received in SUB when binding the SUB and connecting the PUB
Description
Environment
Tested on Linux.
Attachments
Activity

PieterP November 6, 2013 at 9:53 PM
Duplicate of

Guido G. August 29, 2013 at 6:29 PMEdited
Confirmed on todays master.
Also happens on tcp transport on local machine.
To it seems that the connection is not in "ready" state in this configuration,
which might hold back the proper handling of the subscription.
The poll seems to trigger something that allows the connection to be recognized
by the SUB socket.
As of now I didn't find out how the bind/connect thing works.
edit:
Just found out that the above mentioned poll trick does not work w/ tcp
only with inproc.

estabroo August 24, 2013 at 1:35 PM
An odd thing to note, if you put a poll of any duration before the send the subsock will receive the message.
memset(&pollitem, 0, sizeof(zmq_pollitem_t));
pollitem.socket = subsock;
pollitem.events = ZMQ_POLLIN;
ret = zmq_poll(&pollitem, 1, 1);
/* sendmsg */
/* original poll */
In a very simple test case with two sockets (PUB and SUB), binding the PUB socket and connecting the SUB socket works. But when binding the SUB socket and connecting the PUB socket, the message is not received (tested with both zmq_poll() and zmq_recvmsg()).
Since it worked with ZeroMQ 2.2, I was told on #zmq that it's an issue related to the fact that subscription is now done on the PUB side.