Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Paho Mqtt C Client: Automatic reconnect issue when connection is lost.
Paho Mqtt C Client: Automatic reconnect issue when connection is lost. [message #1767238] Tue, 04 July 2017 05:45
Vicky Sharma is currently offline Vicky SharmaFriend
Messages: 3
Registered: May 2017
Junior Member


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.onSuccess = onConnect;
conn_opts.onFailure = onConnectFailure;
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.?
Previous Topic:Python Example and documentation out of date
Next Topic:Export Paho Project into an executeable jar-file
Goto Forum:
  


Current Time: Thu Sep 20 16:12:46 GMT 2018

Powered by FUDForum. Page generated in 0.01730 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top