It seems like zmq_send blocks after zmq_bind and before the other side
connects to the endpoint.
For example, the following code:

void *sock = zmq_socket(ctx, ZMQ_PAIR);
zmq_bind(sock, "tcp://*:9090");
zmq_msg_t msg;
zmq_msg_init_size(&msg, 5);
memcpy(zmq_msg_data(&msg), "hello", 5);
zmq_send(sock, &msg);  // Blocks until someone connects
zmq_msg_close(&msg)

If "zmq_bind" is replaced with "zmq_connect" then it doesn't block. I would
expect zmq_send to buffer outgoing messages in both scenarios (bind and
connect). This behavior doesn't seem to be documented anywhere (i.e. most
of the docs seem to give the impression that bind and connect are similar
in this sense), yet this is a significant difference between the two. Can
anyone comment on why this is the behavior for bind?
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to