[zeromq-dev] missing events ZMQ_FD / ZMQ_EVENTS

Justin Karneges justin at affinix.com
Wed Jun 27 21:57:43 CEST 2012


On Wednesday, June 27, 2012 12:44:45 PM Paul Colomiets wrote:
> On Tue, Jun 26, 2012 at 2:16 AM, Justin Karneges <justin at affinix.com> wrote:
> > Does this mean that maybe I need to check ZMQ_EVENTS not only after read
> > indications on the fd, but also after anytime I call zmq_recv() ?
> 
> I've not tried REP sockets with asynchronous event loop (XREP usually
> needed). But I'm pretty sure, you're right. You need to recheck
> ZMQ_EVENTS after doing zmq_recv(), as the state of the socket changes
> at that time (it's not writable before not because of network issues
> but because of state machine).

Yeah I understand the ability to write is part of the state change that occurs 
by reading. I just wonder why the ZMQ_FD isn't triggered internally by 
zmq_recv(). That would have been more intuitive I think.

> However, checking ZMQ_EVENTS after each zmq_recv and zmq_send is
> needed anyway, as described in current documentation and in this ML
> thread.

In which document is this described? I do not see this in the ZMQ_EVENTS 
section of the zmq_getsockopt man page in 2.2.0.

In any case, thanks for clarifying. I'd actually gone ahead and changed my 
code to check ZMQ_EVENTS after all three scenarios (post zmq_recv, post 
zmq_send, and upon read indication of the ZMQ_FD), and that managed to get 
things to work properly.

Justin



More information about the zeromq-dev mailing list