[zeromq-dev] ZMQ_EVENTS not working correctly with ZMQ_ROUTER_MANDATORY

Radek Svoboda radek.svoboda at gmail.com
Tue Jun 6 10:09:14 CEST 2017


Following pseudocode fails on asserts, although it should not:

zmq::socket_t router(ctx,ZMQ_ROUTER); router.setsockopt(ZMQ_SNDHWM,10);
router.setsockopt(ZMQ_ROUTER_MANDATORY,1); router.bind("inproc://test");
while(publish.getsockopt<int>(ZMQ_EVENTS) & ZMQ_POLLOUT)
{
assert(s_sendmore(router,"DEALERID",ZMQ_DONTWAIT));
assert(s_sendmore(router,"",ZMQ_DONTWAIT));
assert(s_send(router,"HELLO",ZMQ_DONTWAIT));
}
The problem is that getsockopt() signals free slot for message to be sent,
but it is not. Is this behavior a bug or undocumented feature of
ZMQ_ROUTER_MANDATORY?

Thank you
Radek Svoboda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20170606/9138b671/attachment.htm>


More information about the zeromq-dev mailing list