[zeromq-dev] External Event Loop

Martin Sustrik sustrik at 250bpm.com
Wed Jan 26 15:12:59 CET 2011


On 01/26/2011 08:39 AM, Praveen Baratam wrote:

> Here is a schematic that works
> 1. Create a XREQ socket
> 2. Set the identity
> 3. connect to XREP endpoint using inproc transport. (XREP
> is continuously sending messages to named XREQ endpoints on another thread)
> *4. Do a non-blocking recv on the socket until EGAIN is returned*
> 5. Get the FD through ZMQ_FD
> 6. Create a poll-set and poll for events in a loop
> 7. Process those events with in the loop

> Step 4 was necessary to get any events from poll/epoll on the FD from
> ZMQ_FD.

Yes. The socket is initially considered ready for reading & writing. 
Given that ZMQ_FD is edge triggered, you won't get next event unless you 
fail to send/recv a message.

Martin




More information about the zeromq-dev mailing list