[zeromq-dev] zmq_msg_recv not blocking
KIU Shueng Chuan
nixchuan at gmail.com
Mon Nov 23 14:31:14 CET 2015
Note that zmq_msg_recv() returns >= 0 on success.
On 23 Nov 2015 19:54, "Jeff Shanab" <jshanab at jfs-tech.com> wrote:
> I have used a previous version of zmq with google protocol buffers a few
> years ago but am trying a simpler project with the newest zmq and have run
> into a problem.
>
> Imagine the weather server and client converted to the multipart message
> code in the guide. But when I call zmq_msg_recv(&part, subscriber,0), it
> does not block!
>
> do {
> /* Create an empty ØMQ message to hold the message part */
> zmq_msg_t part;
> int rc = zmq_msg_init (&part);
> assert (rc == 0);
> /* Block until a message is available to be received from socket */
> rc = zmq_msg_recv (&part, subscriber,0);
>
> if (rc != 0)
> {
> std::cout << "First msg Recv error :" << zmq_errno() <<
> zmq_strerror (zmq_errno()) << std::endl;
>
> boost::this_thread::sleep(boost::posix_time::milliseconds(250));
> continue;
> };
>
> rc = zmq_getsockopt (subscriber, ZMQ_RCVMORE, &more, &more_size);
> assert (rc == 0);
>
> ....
>
> With this code, I get
>
> First msg Recv error :35Resource temporarily unavailable
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed out
> First msg Recv error :60Operation timed o ...
>
> This is on OSX. I am going to try windows and linux after work tonight.
>
> Are there any known issues with 4.1.3, zmq_msg_recv and OSX ?
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20151123/c22345ba/attachment.htm>
More information about the zeromq-dev
mailing list