[zeromq-dev] changing the C++ api to not throw exceptions on EFSM

Yi Ding yi.s.ding at gmail.com
Fri Jan 27 15:14:39 CET 2012


You mean:


> send (s, msg);
> recv (s, msg) => EAGAIN
> poll (s);
> recv (s, msg) => OK
> recv (s, msg) => EAGAIN
> send (s, msg);
> recv (s, msg) => EAGAIN

poll (s);
> recv (s, msg) => OK
> recv (s, msg) => EAGAIN
>
> Right?

The issue is that the second EAGAIN is replaced by EFSM.

At least here's the way I understood it, please feel free to correct me:
1) right after sending a message, call recv immediately to reset the edge
triggering, otherwise select/epoll will never return.
2) after receiving a message with OK, call receive again to check if
there's anything else coming down the wire / reset the edge triggering.

I guess for req-rep, step number 2 may not be necessary (unless we want to
handle multi-part messages, which has a different check anyways) but the
general advice people have given on this list is to use a while loop when
recving.

I can write some example code with select/epoll if you'd like to test it
yourself.

Thanks,
Yi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120127/a690d5d9/attachment.htm>


More information about the zeromq-dev mailing list