Open adadKKKX opened 2 years ago
I had the same problem with version 4.9.0. From the source code it seems that in case of error it throws an exception and if everything works fine it returns the number of read bytes. So, my understanding is that we should not check for the errno but handle the exception if they are thrown. What I don't understand is why it's marked with NODISCARD, it feels like the returned number of bytes can be safely ignored.
It would be nice if those details were better documented.
btw here are the relevant code:
ZMQ_NODISCARD
recv_result_t recv(message_t &msg, recv_flags flags = recv_flags::none)
{
const int nbytes =
zmq_msg_recv(msg.handle(), _handle, static_cast<int>(flags));
if (nbytes >= 0) {
assert(msg.size() == static_cast<size_t>(nbytes));
return static_cast<size_t>(nbytes);
}
if (zmq_errno() == EAGAIN)
return {};
throw error_t();
If there is no error then I think it will not set errno. But you don't need to check errno at all because either the function is successful (non-null result), or null result (only if non-blocking) or throws an exception.
True, so I guess there is really a bug in some place. I received the same error ("Resource temporarily unavailable") but no exception was thrown and the message was in fact successfully received.
Hello. i'm using req/resp.
Env
it works on windows10 (req) & Ubuntu Port Binoic (Resp) (armv8) the same code is worked on yesterday .but now it does not work. ,the zppzmq version is same 425
Problem
when i send ,it return "Resource temporarily unavailable" all device
Code
protobuf script
https://paste.ubuntu.org.cn/4545606
Req
resp
%%
i thought i does not require it work on non-block. so i can't understand this problem . maybe this is bug!