Connection issues

更新时间:
复制 MD 格式

This topic describes potential issues and solutions when you connect devices using C Link software development kit (SDK) versions 3.x and 2.3.0.

Background information

If you have not yet connected to IoT Platform, use the latest version of the SDK. For more information, see Overview.

Why is the heartbeat interval passed by the SDK different from the connection parameter in the MQTT Connect package?

The SDK doubles the heartbeat interval that you provide and sends the result to IoT Platform as the MQTT Connect parameter.

To adjust the heartbeat interval, modify the corresponding parameter in the files for the following SDK versions.

SDK versionFileParameter
3.x./src/mqtt/impl/iotx_mqtt_client.c_mqtt_connect
2.3.0./src/protocol/mqtt/client/mqtt_client.c iotx_mc_connect

How to modify general configurations

When you compile the SDK library or an executable file, you can search for the default macro definition in the config file or the SDK source code and modify it.

The following are commonly used macro definitions:

Macro definitionDescription
CONFIG_MQTT_TX_MAXLENMQTT send buffer
CONFIG_MQTT_RX_MAXLENMQTT receive buffer
IOTX_MC_REQUEST_TIMEOUT_DEFAULT_MSHeartbeat interval
IOTX_MC_KEEPALIVE_PROBE_MAXMaximum number of lost heartbeats

What do I do if the "mqtt read buffer is too short" error occurs during an MQTT connection?

The default MQTT buffer size in the SDK is 1024 bytes. This error occurs when the length of a single received MQTT message exceeds this value. To resolve this issue, you must increase the MQTT buffer size.

To resolve this issue, search for the CONFIG_MQTT_RX_MAXLEN macro in the SDK source code and set it to the required size.

Similarly, if this error occurs when you send a message, modify the value of CONFIG_MQTT_TX_MAXLEN to resolve the issue.

What do I do if the "The message length 2693 is too long" error occurs during a CoAP connection?

This error indicates that the reported message is too long. To resolve this issue, modify the value of COAP_MSG_MAX_PDU_LEN.