MQTT can't get the full data for subscribed topics

Hi, 

I'm using nRF9160, NCS2.2.0, and using serial_lte_modem sample.

Recently, I have developed a program for MQTT, and I encountered the following phenomenon.

1. nRF9160 subscribed to a topic.

2. I send some data to the topic.

3. When the size of this data exceeds 670 Bytes, nRF9160 only read a part of this data, and the rest of this data is unreadable.

I debug the code to locate the following problem:

In file slm_at_mqtt.c, path: ${NCS_ROOT}/nrf/applications/serial_lte_modem/src/mqtt_c/slm_at_mqtt.c:92

do {
		ret = mqtt_read_publish_payload(c, rsp_buf, sizeof(rsp_buf));
		if (ret > 0) {
			data_send(rsp_buf, ret);
			size_read += ret;
		}
	} while (ret >= 0 && size_read < evt->param.publish.message.payload.len);

Firstly, I calll mqtt_read_publish_payload() to get this data, the 'ret' return 570, it is means i get 570Bytes from MQTT, but I send size is 670 Bytes.

Then, continue reading data, but the 'ret' return a negative error code(-11).

Finally, the MQTT disconnect.

How do I get the rest of this data?

Best Regards,

Yang Hu

Parents Reply Children
No Data
Related