This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Sai,
After tested, customer found that if he uses iothub_client_sample_mqtt in Azure plug-in, when he tries to connect to Azure Cloud, no confirmation callback invoked , with Ethernet customer get “ Service Status: DHCPC : Enabled : Running : 019” and sometime “Service Status: DHCPC : Enabled : Fault : 005”
But, if he uses simplesample_http in Azure plug-in, he can connect to Azure cloud successfully (confirmation callback works normal, he got good value from Cloud).
So, could you help to clarify what’s the difference between these 2 samples? Why mqtt sample fails but http works? Thanks a lot.
Regards
David
Hello David,
Since this is a different topic to the original question, I will split the thread and address it as a new thread.
Thanks,
Sai
Hello David,
I could not reproduce the issue. I was able to run both the examples (iothub_client_sample_mqtt and simplesample_http) successfully.
The following is the Console output for iothub_client_sample_mqtt example. Please ensure that the "connectionString" is updated to the right value (refer to Quick Start Guide for more details).
Service Status: DHCPC : Enabled : : 000 Service Status: DHCPC : Enabled : Running : 000 Starting the iohub_client_sample_mqtt example Network Added: If-1:192.168.0.140 Service Status: DHCPC : Enabled : Running : 017 Current time: Wed Jun 5 19:17:32 2019 IoTHubClient_LL_SetMessageCallback...successful. IoTHubClient_LL_SendEventAsync accepted message [0] for transmission to IoT Hub. IoTHubClient_LL_SendEventAsync accepted message [1] for transmission to IoT Hub. IoTHubClient_LL_SendEventAsync accepted message [2] for transmission to IoT Hub. IoTHubClient_LL_SendEventAsync accepted message [3] for transmission to IoT Hub. IoTHubClient_LL_SendEventAsync accepted message [4] for transmission to IoT Hub. Confirmation[0] received for message tracking id = 0 with result = IOTHUB_CLIENT_CONFIRMATION_OK Confirmation[1] received for message tracking id = 1 with result = IOTHUB_CLIENT_CONFIRMATION_OK Confirmation[2] received for message tracking id = 2 with result = IOTHUB_CLIENT_CONFIRMATION_OK Confirmation[3] received for message tracking id = 3 with result = IOTHUB_CLIENT_CONFIRMATION_OK Confirmation[4] received for message tracking id = 4 with result = IOTHUB_CLIENT_CONFIRMATION_OK
Thanks,
Sai
Hello Sai,
I confirm that connection string is good. But with http's samle, it's OK and with mqtt's sample, I fail.
May I know:
1. mqtt sample: is it simple mqtt or mqtt over TCP or mqtt over websocket?
2. What's the NDK service code stands for? I get " Service Status: DHCPC : Enabled : Fault : 002", "Service Status: DHCPC : Enabled : Fault : 005" and sometimes "Service Status: DHCPC : Enabled : Running : 019"
Thanks.
Cindy
Hello Cindy,
Cindy Zhan said:1. mqtt sample: is it simple mqtt or mqtt over TCP or mqtt over websocket?
The example uses the MQTT provided in the Azure IoT SDK. Not sure what kind of MQTT is used by Azure IoT SDK.
Cindy Zhan said:2. What's the NDK service code stands for? I get " Service Status: DHCPC : Enabled : Fault : 002", "Service Status: DHCPC : Enabled : Fault : 005" and sometimes "Service Status: DHCPC : Enabled : Running : 019"
I am not sure what each of those exact error codes mean. However it is clear that the DHCP client is having some issue getting IP address. If the IP address is not acquired then no attempt will be made to start the MQTT or HTTP layers.
The code for starting the DHCP client and acquiring IP address is same in all the examples provided in the Azure Plugin. So I am puzzled as to why this error would be generated. As mentioned before I am not able to reproduce it in my network with the examples (iothub_client_sample_mqtt and simplesample_http) provided in Azure Plugin.
Can you confirm if you are
Thanks,
Sai
Hello Sai,
I confirm that I did 100% same modification on iothub_client_sample_mqtt and sample_http. And same network, same evaluation board , everything is the same. So this makes me quite confused.
Regarding the failure when using mqtt sample, the "DHCPC: Enabled: Fault:005" only comes after try to connect to cloud. In the very begining, it get good IP address and I can successfully ping to it. Can you please help to check the magic "005" "019" code means in NDK service? I suppose it will give us some clues.
Thanks.
Hi Sai,
Now Cindy wants to use mqtt_websockets protocol, when she modified the code based on iothub_client_sample_mqtt_MSP_EXP432E401Y_tirtos_ccs project as below, she find that there are some error shows “error #10234-D: unresolved symbols remain”.
Modification Stage:
Add the head file in iothub_client_sample_mqtt.c:
#include "iothubtransportmqtt_websockets.h"
Modify the protocol from MQTT_Protocol to MQTT_WebSocket_Protocol:
if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, MQTT_WebSocket_Protocol)) == NULL)
When rebuild the project, error shows that:
So could you help to figure out the issue or give an example with MQTT_WebSocket_Protocol? Thanks.
Hello David,
The prov_dev_client_II_sample example utilizes the MQTT_WebSocket_Protocol. Let me know if you need any further help setting WebSocket up.
Regards,
Dalton
Hey Cindy,
To elaborate on what Sai already answered, the DHCP error codes (ie when it reports "Fault") are referring to what state the DHCP state machine is in when an error occurred. They correspond to the enum I pasted below (found in the NDK at nettools/dhcp/dhcp.h)
/* States */ enum DhcpState { STATEZERO, BOUND, INIT, REBINDING, REBOOTING, RENEWING, REQUESTING, SELECTING, DHCPEND };
So it looks like you hit errors in the INIT and RENEWING states.
The codes when the DHCPC is "Running" correspond to the following #defines in the ndk/inc/nettools/inc/dhcpif.h file
/* Running Codes (State codes are all less than 0x10) */ #define DHCPCODE_IPADD 0x11 /* Client has added an address */ #define DHCPCODE_IPREMOVE 0x12 /* IP address removed and CFG erased */ #define DHCPCODE_IPRENEW 0x13 /* IP renewed, DHCP config space reset */
So your "Running" code corresponds to DHCPCODE_IPRENEW.
Regards,
Dalton
**Attention** This is a public forum