<html><head></head><body bgcolor="#FFFFFF"><div>Is the broker running on the host and port you're connecting to?</div><div><br></div><div>Have you tried contacting the author of this library?</div><div><br></div><div>On 25 May 2013, at 09:55, shivang vyas <<a href="mailto:shivangvyas2008@gmail.com">shivangvyas2008@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>using this library for ios rabbitmq client integration: <a href="https://github.com/bimawa/librabbitmq-objC">https://github.com/bimawa/librabbitmq-objC</a><div><br></div><div>here is an iOS - obj C code: </div><div><br></div><div>
<p class="p1">}</p>
<p class="p1">-(<span class="s1">void</span>)establish{</p>
<p class="p2"> </p>
<p class="p3"><span class="s2"> </span>AMQPConnection<span class="s2"> *connection = [[</span>AMQPConnection<span class="s2"> </span>alloc<span class="s2">] </span>init<span class="s2">];</span></p>
<p class="p1"> <span class="s3">NSError</span> *error, *error1,*error2,*error3;</p>
<p class="p4"><span class="s2"> [connection </span><span class="s3">connectToHost</span><span class="s2">:</span><hostname><span class="s2"> </span><span class="s3">onPort</span><span class="s2">:<portno> </span><span class="s3">error</span><span class="s2">:&error] ? </span><span class="s3">NSLog</span><span class="s2">(</span>@"Connected to host"<span class="s2">):</span><span class="s3">NSLog</span><span class="s2">(</span>@"not connected to host"<span class="s2">);</span></p>
<p class="p2"> </p>
<p class="p3"><span class="s2"> [connection </span>loginAsUser<span class="s2">:</span><span class="s4">@"guest"</span><span class="s2"> </span>withPasswort<span class="s2">:</span><span class="s4">@"guest"</span></p>
<p class="p1"> <span class="s3">onVHost</span>:<span class="s4">@"/"</span> <span class="s3">error</span>:&error1];</p>
<p class="p2"> </p>
<p class="p1"> <span class="s3">AMQPChannel</span> *channel = [connection <span class="s3">openChannel</span>];</p>
<p class="p3"><span class="s2"> </span>AMQPExchange<span class="s2"> * exchange = [[</span>AMQPExchange<span class="s2"> </span>alloc<span class="s2">] </span>initExchangeWithName<span class="s2">:<exchangename></span></p>
<p class="p1"> <span class="s3">onChannel</span>:channel];</p>
<p class="p2"> </p>
<p class="p3"><span class="s2"> </span>AMQPQueue<span class="s2"> *queue = [[</span>AMQPQueue<span class="s2"> </span>alloc<span class="s2">] </span>initWithName<span class="s2">:</span><span class="s4">@"my_queue"</span><span class="s2"> </span>onChannel<span class="s2">:channel];</span></p>
<p class="p1"> [queue <span class="s3">bindToExchange</span>:exchange <span class="s3">withKey</span>:<span class="s4">@"99999"</span> <span class="s3">error</span>:&error3];</p>
<p class="p2"> </p>
<p class="p3"><span class="s2"> </span>AMQPConsumer<span class="s2"> *consumer = [[</span>AMQPConsumer<span class="s2"> </span>alloc<span class="s2">] </span>initForQueue<span class="s2">:queue </span>onChannel<span class="s2">:&channel</span></p>
<p class="p1"> <span class="s3">useAcknowledgements</span>:<span class="s1">YES</span></p>
<p class="p1"> <span class="s3">isExclusive</span>:<span class="s1">NO</span></p>
<p class="p1"> <span class="s3">receiveLocalMessages</span>:<span class="s1">NO</span></p>
<p class="p1"> <span class="s3">error</span>:&error2</p>
<p class="p1"> <span class="s3">deepLoop</span>:5];</p>
<p class="p3"><span class="s2"> </span>AMQPConsumerThread<span class="s2"> *consumerThread = [[</span>AMQPConsumerThread<span class="s2"> </span>alloc<span class="s2">] </span>initWithConsumer<span class="s2">:consumer </span>delegate<span class="s2">:(</span><span class="s1">id</span><span class="s2">)</span><span class="s1">self</span><span class="s2"> </span>nameThread<span class="s2">:</span><span class="s4">@"shivng_thread"</span><span class="s2">];</span></p>
<p class="p1"> [consumerThread <span class="s3">start</span>];</p>
<p class="p2"> </p>
<p class="p2"> </p>
<p class="p2"> </p>
<p class="p1">}</p>
<p class="p2"><br></p>
<p class="p1">-(<span class="s1">void</span>)amqpConsumerThreadReceivedNewMessage:(<span class="s3">AMQPMessage</span>*)theMessage{</p>
<p class="p1"> <span class="s3">NSLog</span>(<span class="s4">@"message = %@"</span>, theMessage);</p>
<p class="p1"> <span class="s3">NSLog</span>(<span class="s4">@"message.body = %@"</span>, theMessage.<span class="s3">body</span>);</p>
<p class="p1">}</p>
<p class="p1">-(<span class="s1">void</span>)amqpConsumerThreadLoseConnection{</p>
<p class="p4"><span class="s2"> </span><span class="s3">NSLog</span><span class="s2">(</span>@"Consumer thread lost connection"<span class="s2">);</span></p>
<p class="p1">}</p>
<p class="p2">application just got hanged while calling : </p><p class="p2"><span class="s2"> [connection </span>loginAsUser<span class="s2">:</span><span class="s4">@"guest"</span><span class="s2"> </span>withPasswort<span class="s2">:</span><span class="s4">@"guest"</span></p><p class="p1"> <span class="s3">onVHost</span>:<span class="s4">@"/"</span> <span class="s3">error</span>:&error1];</p><p class="p1"><br></p><p class="p1">the reason is, function: </p><p class="p1">
</p><p class="p1"><span class="s1">result = </span>recv<span class="s1">(state-></span>sockfd<span class="s1">, state-></span>sock_inbound_buffer<span class="s1">.</span>bytes<span class="s1">,state-></span>sock_inbound_buffer<span class="s1">.</span>len<span class="s1">, 0);</span></p><p class="p1">doesn't return back, just waiting waiting......</p><p class="p1">app waiting for executing next other statements after the above line...</p><p class="p1"><br></p></div><div><br><div><br></div><div><br></div></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>rabbitmq-discuss mailing list</span><br><span><a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a></span><br><span><a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a></span><br></div></blockquote></body></html
>