Stuff I ran into when implementing: 1) Be aware that ZMQ_FD only generates read events. You then check ZMQ_EVENTS to see what actually happened.
2) You need to check ZMQ_EVENTS in three situations: after ZMQ_FD read event, after calling zmq_send, and after calling zmq_recv. It was only recently documented that you need to check in the latter two situations, so this is easy to miss. For example, if you have a REP socket that triggers a ZMQ_FD read, and then ZMQ_EVENTS reports that it is readable, and then you call zmq_recv() to obtain a message from the socket, you might NOT get another read event on ZMQ_FD to tell you to check ZMQ_EVENTS to see that the socket is now writable. Instead, you should check ZMQ_EVENTS immediately after zmq_recv() to learn if the socket has become writable. On Monday, August 06, 2012 09:18:18 AM diffuser78 wrote: > Can someone plz share their experiences around this problem ? > > On Fri, Aug 3, 2012 at 3:38 PM, diffuser78 <[email protected]> wrote: > > Hi, > > > > I am writing a lib that uses zmq. This lib is going to be used in an app > > that already has an external select() loop. Can I use fd's retrieved from > > ZMQ_FD from zmq_getsockopt() in that select loop successfully ? > > > > Are there examples already that tell you how to do it ? Are there any > > things that I should know ? > > > > I read FAQ section related zmq_poll and also saw man zmq_getsocketopt for > > ZMQ_FD. > > > > I wanted to know the persoanl experience of some developer around this. > > > > I greatly appreciate your response. > > > > Thanks. > > > > DJ _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
