Would it make sense to deprecate socket_t::recv(void *buf) and socket_t::send(void *buf) ? The implementation of zmq_recv() and zmq_send() in zmq.cpp just copies from/to a zmq_msg_t anyway.
On Wed, May 29, 2013 at 4:56 AM, Pieter Hintjens <[email protected]> wrote: > 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 >
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
