libmosquitto : mosquitto_loop running indefinitely

Asked by dpux

Hello all,

I am trying using libmosquitto on iOS. Connection, subscription is working fine, but when I am accessing this code (from the sample client code provided here : http://mosquitto.org/man/libmosquitto-3.html

do
{
     rc = mosquitto_loop(mosq, -1);
     printf("%d", rc);
}
while(rc==MOSQ_ERR_SUCCESS);

This seems to run indefinitely, the "rc" value is 0 always - even if I shut down the mosquitto broker, or even disconnect my system from network.

Is it an iOS specific issue ? If I am not doing this in a continuous loop and instead running this periodically (say once in 10 seconds), this is able to detect network status, etc. But this approach is giving me a latency of 10 seconds in receiving any messages on my subscription. Where am I wrong ?

Thanks !

Question information

Language:
English Edit question
Status:
Expired
For:
mosquitto Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Roger Light (roger.light) said :
#1

That certainly sounds odd. I have heard of it working on iOS with no more details on any problems but that doesn't necessarily mean anything.

I can't think of what would cause it to work if you leave a gap inbetween calls of mosquitto_loop(). I'll have a closer look, but I'm off to bed first! :)

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.