[zeromq-dev] ZMQ_FD clarification
Justin Karneges
justin at affinix.com
Tue Dec 23 21:31:12 CET 2014
On Tue, Dec 23, 2014, at 12:24 PM, Maurice Barnum wrote:
> In the 4.0 api documentation for getsockopt, I see this:
>
> "As the descriptor is edge triggered, applications must update the state
> of ZMQ_EVENTS after each invocation of zmq_send or zmq_recv."
>
> I don't understand what it means to update the state of ZMQ_EVENTS as it
> is not documented as with zmq_setsockopt().. Do I need to call
> zmq_getsockopt(..ZMQ_EVENTS..) after I am done with a zmq_send or
> zmq_recv to see if the socket is now readable and act accordingly?
Correct, you call zmq_getsockopt with ZMQ_EVENTS whenever the fd
obtained via ZMQ_FD becomes readable, as well as after any call to
zmq_send or zmq_recv for that socket. I believe the "update the state"
wording here means updating the application's own state by retrieving
the current ZMQ_EVENTS.
Justin
More information about the zeromq-dev
mailing list