Open zhengasif opened 10 months ago
已收到,我会尽快回复!
Can you check what does your transport send/writev function return? If it returns success, MQTT has no way to determine that the data was not actually sent. In that case the MQTT keep alive should detect broken connection, which it seems to do. If the transport send does not return success, then it may be a bug in the library to return success.
hi
I check the return of send function, it return scuccess but no msg in my broker.
For this case, how can I do to make my code more robust, set qos1 or add some other code to check the return msg?
Hey @zhengasif sorry that you've been seeing this issue. I was wondering if you've verified that you're able to connect to the broker with the credentials that you're using on your device?
If you have verified this could you then try hosting, and then connecting to, a local MQTT broker? This way you can inspect the packets that are coming into and out of the broker using Wireshark or a similar utility. This would help us figure out what the root cause of your problem is
已收到,我会尽快回复!
set qos1 or add some other code to check the return msg?
That should help to catch broken connection.
hi teams
I'm using the latest version of embedded sdk in my arm-linux device. I found an error that MQTT_Publish() return MQTTSuccess,but in fact there are no messages in broker ,and after 5 seconds it returns MQTTKeepAliveTimeout because of the bad network condition.I set QOS0 for my msgs. why it is like that in poor network condition? my code is like below: mqttStatus = MQTT_Publish( &AwsMqttContext,&outgoingPublishPackets[publishIndex].pubInfo,outgoingPublishPackets[publishIndex ].packetId); if(mqttStatus!=MQTTSuccess ) { printf("Failed to send PUBLISH packet to broker with error = %s.",MQTT_Status_strerror(mqttStatus)); returnStatus = EXIT_FAILURE; cleanupOutgoingPublish( publishIndex ); } else { printf( "PUBLISH sent for topic %.*s to broker with packet ID %u.\n\n",strlen(pub_topic),pub_topic,outgoingPublishPackets[ publishIndex ].packetId); } The log file is in the attachment.