Hi, On Wed, Jun 27, 2012 at 10:57 PM, Justin Karneges <[email protected]> wrote: > On Wednesday, June 27, 2012 12:44:45 PM Paul Colomiets wrote: >> On Tue, Jun 26, 2012 at 2:16 AM, Justin Karneges <[email protected]> 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. >
For performance reasons: its cheaper to call zmq_getsockopt, than to write to, poll and read from fd. >> 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. > It's seems it was late for 2.2, but it is in current master both for 2.x and 3.x series. > 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. > Nice. -- Paul _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
