Hi All:
I don’t see this addressed specifically in the docs, in the GitHub issues, or
here, so thought I’d ask.
I bind an inproc sub socket for inter-thread communication, which I include in
zmq_poll. When I want to e.g., subscribe from a different thread I create a
pub socket, connect to the first and send it a command message, which then gets
executed on the main zmq thread. So far, so good.
What I’m wondering if it’s OK to immediately disconnect the socket after
calling zmq_send, like so:
void* temp = zmq_socket(impl->mZmqContext, ZMQ_PUB);
zmq_connect(temp, ZMQ_CONTROL_ENDPOINT);
zmq_pollitem_t pollitems [] = { { temp, 0, ZMQ_POLLIN, 0 } };
CALL_ZMQ_FUNC(zmq_poll(pollitems, 1, 1)); // see
https://github.com/zeromq/libzmq/issues/2267
zmq_send(temp, msg, msgSize, 0);
zmq_disconnect(temp, ZMQ_CONTROL_ENDPOINT);
zmq_close(temp);
This *seems* to work, but I’m concerned that maybe I’m just getting "lucky”?
It does *not* appear to work with ZMQ_PAIR sockets, for whatever reason,
although I’ve seen that approach recommended in a few places.
Thanks in advance for any assistance!
Regards,
Bill Torpey
_______________________________________________
zeromq-dev mailing list
[email protected]
https://lists.zeromq.org/mailman/listinfo/zeromq-dev