I am currently working with SDK 1.7.1, using the azure_iot_hub sample application.
This is a continuation of this topic:
Further to clarify an issue I have run into, I have found something related in another topic here:
To quote from this above topic...
"You need to call mqtt_live() after mqtt_disconnect() for the mqtt library to close the socket.
If not, you will run out of sockets, and get ENOMEM (-12)."
Although the issue I believe I was having is that I was not handling a connect error correctly when attempting to reconnect to Azure (MQTT) however, I believe that I will encounter this error ENOMEM even if I implement the functionality to reattempt the reconnection upon receiving this error -12 (ENOMEM).
In the mean time I will attempt to implement the reconnection retry code, however, I believe I may encounter this above error on every reconnect attempt.
Can I verify that upon disconnect from Azure due to network issues or Azure server issues (aka receiving the event AZURE_IOT_HUB_EVT_DISCONNECTED) that the socket(s) will be cleared to avoid running out of sockets? As last recourse I can perform a soft reset to recover and reconnect upon Azure disconnection, but would like to avoid this if possible.
If this is not the case, can I clear the sockets in the application layer using mqtt_live()? I would prefer to not bypass and directly access objects that are managed in the library if possible.
Sincerely,
Allan