Makes sense to me; zero is not a valid error code in any case and that
return statement is totally inconsistent with the previous one (nbytes
>= 0).

-Pieter

On Tue, May 28, 2013 at 9:17 PM, Christian Kögler <[email protected]> wrote:
> We discussed in our team to use zero-length messages. We found out, that C++
> API cppzmq has a problem. In send/recv it is not possible to differ between
> an empty or no message, if ZMQ_DONTWAIT is used.
> An example, which fails if zero-length messages are used:
>
> char buffer[8];
> while(socket.recv(buffer, sizeof(buffer), ZMQ_DONTWAIT) >= 0)
>   {std::cout << "received a message" << std::endl;}
> std::cout << "never reached" << std::endl;
>
> I propose to return a negativ value and not zero ([1]), if no message was
> received (or send).
>
> Best regards
> Christian Kögler
>
> [1] https://github.com/zeromq/cppzmq/blob/master/zmq.hpp#L392
>
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to