Azure-iot-sdk-c: The device has been disconnecting error while trying to send data to hub , could anyone tell me what is the main reason?

Created on 18 Dec 2018  路  5Comments  路  Source: Azure/azure-iot-sdk-c

I am using MQTT as a protocol, i just trying to change DEFAULT_CONNACK_TIMEOUT value in the iothubtransport_mqtt_commn.c .

this is function :
(void)IoTHubDeviceClient_LL_SetConnectionStatusCallback(device_ll_handle, connection_status_callback, NULL);

static void connection_status_callback(IOTHUB_CLIENT_CONNECTION_STATUS result, IOTHUB_CLIENT_CONNECTION_STATUS_REASON reason, void* user_context)
{
(void)reason;
(void)user_context;
// This sample DOES NOT take into consideration network outages.
if (result == IOTHUB_CLIENT_CONNECTION_AUTHENTICATED)
{
(void)printf("The device client is connected to iothub\r\n");
}
else
{
(void)printf("The device client has been disconnected\r\n");
}
}

question

All 5 comments

@chinnaece The way you would set the DEFAULT_CONNACK_TIMEOUT value is this:

int conn_ack_seconds = 20;
IoTHubDeviceClient_LL_SetOption(iothub_ll_handle, OPTION_CONNECTION_TIMEOUT, &conn_ack_seconds);

You should set this right after you call IoTHubDeviceClient_LL_CreateFromConnectionString.

@chinnaece, @jebrando, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey

i would like to send telemetry for every one minute from client to hub using MQTT, unable to send it , please suggest me the way of doing @jebrando

@chinnaece The way you would set the DEFAULT_CONNACK_TIMEOUT value is this:

int conn_ack_seconds = 20;
IoTHubDeviceClient_LL_SetOption(iothub_ll_handle, OPTION_CONNECTION_TIMEOUT, &conn_ack_seconds);

You should set this right after you call IoTHubDeviceClient_LL_CreateFromConnectionString.

Still not working

the problem solved explained in #782

Was this page helpful?
0 / 5 - 0 ratings