[zeromq-dev] zmq_msg_recv not blocking

Jeff Shanab jshanab at jfs-tech.com
Mon Nov 23 12:53:44 CET 2015


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 ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20151123/aebe3b77/attachment.htm>


More information about the zeromq-dev mailing list