[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Paho Mqtt C Client: Automatic reconnect issue when connection is lost.

Hi

I am using Paho Mqtt C Client on my IMX6 device.Providing below some details regarding my code.

MQTTAsync client;
MQTTAsync_connectOptions conn_opts = MQTTAsync_connectOptions_initializer;

Default connection initializer value.
#define MQTTAsync_connectOptions_initializer { {'M', 'Q', 'T', 'C'}, 4, 60, 1, 10, NULL, NULL, NULL, 30, 0,\
NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 1, 60}


  conn_opts.keepAliveInterval = 5;
ÂÂÂ conn_opts.cleansession = 1;
ÂÂÂ conn_opts.automaticReconnect = 1;
ÂÂÂ conn_opts.>ÂÂÂ conn_opts.>ÂÂÂ conn_opts.context = client;

void onConnect(void* context, MQTTAsync_successData* response)
{
ÂÂÂ printf("Successful connection\n");
ÂÂÂ connectionStatus = CONNECTION_OK;
}

void onConnectFailure(void* context, MQTTAsync_failureData* response)
{
ÂÂÂ printf("Connect failed, rc %d\n", response ? response->code : 0);
}


1. The issue i am facing with the sdk is that i am not able to see the prints of onConnectFailure callback sometimes.Although it works fine and i can see the logs most of the time.(2 out of 10 times)
2.
Second issue is i am not able to see onConnect callback prints.If onConnectFailure prints are coming sometimes,same shall be the case with onConnect callback.
3.
What is the exact meaning of connectTimeout value in default initializer.What shall be its value if the keepalive timeout is 5 secs.?