[zeromq-dev] changing the C++ api to not throw exceptions on EFSM
gonzalo diethelm
gdiethelm at dcv.cl
Fri Jan 27 20:10:10 CET 2012
Once you have successfully called recv(), you MUST call send() before calling recv() again.
--
Gonzalo Diethelm
DCV Chile
From: zeromq-dev-bounces at lists.zeromq.org [mailto:zeromq-dev-bounces at lists.zeromq.org] On Behalf Of Yi Ding
Sent: Friday, January 27, 2012 11:15 AM
To: Martin Sustrik
Cc: ZeroMQ development list
Subject: Re: [zeromq-dev] changing the C++ api to not throw exceptions on EFSM
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/3036f1a5/attachment.htm>
More information about the zeromq-dev
mailing list