Message not received in SUB when binding the SUB and connecting the PUB

Description

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.

Environment

Tested on Linux.

Activity

Show:
estabroo
August 24, 2013, 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 */

Guido G.
August 29, 2013, 6:29 PM
Edited

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.

PieterP
November 6, 2013, 9:53 PM

Duplicate of

Duplicate

Assignee

Unassigned

Reporter

Nicolas Martyanoff

Labels

Components

Affects versions

Priority

Major