<div dir="ltr">Raj;<div><br></div><div>The problem with your above code is that you've put the socket descriptor in non-blocking mode and rabbitmq-c doesn't expect this, so when it tries to recv() it gets a error it doesn't understand.</div>
<div><br></div><div>Instead of using select() directly, I'd suggest using a higher-level non-blocking API such as <a href="https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp.h#L2151">amqp_consume_message()</a>�to wait for a message with a time-out. �An example of how to use this API can be found in the <a href="https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_consumer.c">amqp_consumer.c</a> example.</div>
<div><br></div><div>HTH</div><div>-Alan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 13, 2013 at 7:29 AM, kingsmasher1 <span dir="ltr"><<a href="mailto:raj.kumar.sanpui@gmail.com" target="_blank">raj.kumar.sanpui@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We are actually using amqp_basic_consume( �).<br>
I see the difference between them:<br>
<a href="https://github.com/alanxz/rabbitmq-c/issues/37" target="_blank">https://github.com/alanxz/rabbitmq-c/issues/37</a><br>
<br>
Thus, to check indeed there are any messages in the queue, i will have to<br>
keep on calling basic.get in a loop, that's as good as a blocking call like,<br>
basic.consume<br>
<br>
[Regarding your earlier reply about select( ), the file descriptor becomes<br>
readable when, if there are any messages in the queue, right?]<br>
<br>
The best is:<br>
Do we have any API which can just check how many (or if there is any)<br>
message in the queue?<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/Why-is-the-select-always-getting-timed-out-in-consumer-tp32046p32069.html" target="_blank">http://rabbitmq.1065348.n5.nabble.com/Why-is-the-select-always-getting-timed-out-in-consumer-tp32046p32069.html</a><br>

<div class="im HOEnZb">Sent from the RabbitMQ mailing list archive at Nabble.com.<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</div></div></blockquote></div><br></div>