locked
Why does not my IoT hub respond to ping requests RRS feed

  • Question

  • I have created an IoT Hub, and have created a device and I tried to use SDK to communicate with the IoT Hub.

    I get DNS could not resolve from the SDK.

    The I wanted to check if my IoT Hub is alive, so I tried pinging it but it does not respond, why is that?

    Monday, June 1, 2020 5:55 AM

Answers

  • Hi.

    Sorry, I just now saw your response.

    I did manage to solve my problem connecting to the cloud from the SDK.

    I had a problem with DNS resolver not being able to resolve the host address but that was due to software on the embedded device (actually the vsnprintf function in used C library was not working as expected).

    I did however expect that IoT hub which has public IP would respond to ping requests, because I expected to check if my IoT Hub is alive that way.

    I tried pinging it from my PC but got no response, so I did not know if IoT hub does not support ping or if it is not working.

    Anyways, I managed to resolve my issue, but if you have any comment of why IoT hub does not respond to ping requests do let me know.

    Wednesday, June 3, 2020 9:58 AM

All replies

  • Hello,

    Which SDK and protocol are you using? Ensure that you are using correct Connection string and SAS. If you are using MQTT, please see below to understand the Default keep-alive timeout.

    In order to ensure a client/IoT Hub connection stays alive, both the service and the client regularly send a keep-alive ping to each other. The client using IoT SDK sends a keep-alive at the interval defined in this table below:

    Language Default keep-alive interval Configurable
    Node.js 180 seconds No
    Java 230 seconds No
    C 240 seconds Yes
    C# 300 seconds Yes
    Python (V2) 60 seconds No


    Following MQTT spec, IoT Hub's keep-alive ping interval is 1.5 times the client keep-alive value. However, IoT Hub limits the maximum server-side timeout to 29.45 minutes (1767 seconds) because all Azure services are bound to the Azure load balancer TCP idle timeout, which is 29.45 minutes.

    For example, a device using the Java SDK sends the keep-alive ping then loses network connectivity. 230 seconds later, the device misses the keep-alive ping because it's offline. However, IoT Hub doesn't close the connection immediately - it waits another (230 * 1.5) - 230 = 115 seconds before disconnecting the device with the error 404104 DeviceConnectionClosedRemotely.

    The maximum client keep-alive value you can set is 1767 / 1.5 = 1177 seconds. Any traffic will reset the keep-alive. For example, a successful SAS token refresh resets the keep-alive.

    If that doesn’t help, please check Monitor, diagnose, and troubleshoot disconnects with Azure IoT Hub for further troubleshooting. 

    Also, see Use a simulated device to test connectivity with your IoT hub

    Do let us know if you have further queries.

    Monday, June 1, 2020 11:40 AM
  • Hi,

    Have you had a chance to see the above response? Do let us know if you have further queries.

    Wednesday, June 3, 2020 9:40 AM
  • Hi.

    Sorry, I just now saw your response.

    I did manage to solve my problem connecting to the cloud from the SDK.

    I had a problem with DNS resolver not being able to resolve the host address but that was due to software on the embedded device (actually the vsnprintf function in used C library was not working as expected).

    I did however expect that IoT hub which has public IP would respond to ping requests, because I expected to check if my IoT Hub is alive that way.

    I tried pinging it from my PC but got no response, so I did not know if IoT hub does not support ping or if it is not working.

    Anyways, I managed to resolve my issue, but if you have any comment of why IoT hub does not respond to ping requests do let me know.

    Wednesday, June 3, 2020 9:58 AM
  • Thanks for confirming and glad to hear that your issue is resolved. To get the detailed troubleshooting on what went wrong here, I would suggest you please file a support request @ https://aka.ms/azsupt? 
    Friday, June 5, 2020 9:44 AM