[zeromq-dev] Using ZMQ_FD with select

john skaller skaller at users.sourceforge.net
Sun Feb 19 14:59:10 CET 2012

On 20/02/2012, at 12:29 AM, Schmurfy wrote:

> But the descriptor returned by ZMQ_FD is not the "real" descriptor right ?

Says in the manual:

"The ability to read from the returned file descriptor does not necessarily
indicate that messages are available to be read from, or can be written to, the underlying socket; 
applications must retrieve the actual event state with a subsequent retrieval of the ZMQ_EVENTS option."

So it would seem you're right, I'm wrong. Sorry!

It is not clear to me what the semantics are now. If the fd says there's a read possible,
and the ZMQ_EVENTS query doesn't what can it possibly mean?

Do you have to code a loop, selecting on the fd then using ZMQ_EVENTS until
the latter says there's something there?

[It's usual on Unix for event polling to return with no I/O due 
to a signal or something, so you have to just try and then 
poll again].

john skaller
skaller at users.sourceforge.net

More information about the zeromq-dev mailing list