You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I met some problems when using MQTT-C library to communicate with MQTT broker.
When the network connection is broken, mqtt_sync() will use nearly 16 minutes to detect the network connection broken and change the error to MQTT_ERROR_SOCKET_ERROR.
In the first 9 minutes, mqtt_sync() calls __mqtt_recv() and __mqtt_send() without any problem though the network connection is broken.
And in the following 7 minutes, mqtt_sync() is blocked in _mqtt_send() and continuously calls the mqtt_pal_sendall() which causes the CPU load quite high.
Afterwards, the error changes to MQTT_ERROR_SOCKET_ERROR.
I have two questions:
why does mqtt_sync() need so long time to detect the network connection and change the error state?
If I want to check network connection in the inspector callback, is there any example? I have tried to use getsockopt to check socket state, but it does not work.
Thanks for your reply!
The text was updated successfully, but these errors were encountered:
Hi,
I met some problems when using MQTT-C library to communicate with MQTT broker.
When the network connection is broken, mqtt_sync() will use nearly 16 minutes to detect the network connection broken and change the error to MQTT_ERROR_SOCKET_ERROR.
In the first 9 minutes, mqtt_sync() calls __mqtt_recv() and __mqtt_send() without any problem though the network connection is broken.
And in the following 7 minutes, mqtt_sync() is blocked in _mqtt_send() and continuously calls the mqtt_pal_sendall() which causes the CPU load quite high.
Afterwards, the error changes to MQTT_ERROR_SOCKET_ERROR.
I have two questions:
why does mqtt_sync() need so long time to detect the network connection and change the error state?
If I want to check network connection in the inspector callback, is there any example? I have tried to use getsockopt to check socket state, but it does not work.
Thanks for your reply!
The text was updated successfully, but these errors were encountered: