[zeromq-dev] zmq_msg_recv not blocking
Jeff Shanab
jshanab at jfs-tech.com
Mon Nov 23 15:15:55 CET 2015
The Guide has an assert (rc == 0) that of course exited the program.
I replaced that with the if (rc != 0) block to get the error
On Mon, Nov 23, 2015 at 8:31 AM, KIU Shueng Chuan <nixchuan at gmail.com>
wrote:
> 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
>>
>>
> _______________________________________________
> 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/0e4d169e/attachment.htm>
More information about the zeromq-dev
mailing list