← Back to team overview

mosquitto-dev team mailing list archive

[Question #174193]: libmosquitto : mosquitto_loop running indefinitely

 

New question #174193 on mosquitto:
https://answers.launchpad.net/mosquitto/+question/174193

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 !


-- 
You received this question notification because you are a member of
Mosquitto Dev, which is an answer contact for mosquitto.