← Back to team overview

mosquitto-dev team mailing list archive

Re: [Question #174635]: Need help understanding libmqtt code

 

Question #174635 on mosquitto changed:
https://answers.launchpad.net/mosquitto/+question/174635

    Status: Open => Needs information

Roger Light requested more information:
What does mosquitto_connect() return when you have no network?

The design of libmosquitto is that all network read/writes occur in
mosquitto_loop().  Until you actually try to read/write it's not
possible to tell if the network has dropped, so you won't know until you
make the mosquitto_loop() call. It also means that callbacks only get
called when you call mosquitto_loop().

The disconnect callback only gets called if you have a successful
network connection in the first place. If you're having problems getting
connected in the first place then it's no surprise it's not getting
called :)

I still can't explain why mosquitto_loop() returns MOSQ_ERR_SUCCESS when
you lose your network connection.

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