This is not guaranteed to work. There is internal buffering and readabilty/writability is unrelated to the readability/writability of the underlying fd. You have to get ZMQ_EVENTS, check that readability/writability does not exist, and then make an IO watcher on the underlying fd.
IIRC, you can't do this in pre-2.1.0 ZMQ; hence, using your own event loop is experimental.
(I suppose it is also possible to see if you get EWOULDBLOCK during an IO operation, and then create the IO watcher, regular-socket-style.)
IIRC, you can't do this in pre-2.1.0 ZMQ; hence, using your own event loop is experimental.
(I suppose it is also possible to see if you get EWOULDBLOCK during an IO operation, and then create the IO watcher, regular-socket-style.)