Azure sphere network switching

95504669 546 Reputation points
2021-12-20T10:57:01.707+00:00

I use Avnet Starter kit Rev2 board. I followed the Azure IOT sample code provided.
https://github.com/Azure/azure-sphere-samples/tree/master/Samples/AzureIoT

Both Ethernet and wifi network interface is working. I implemented both Eth and wifi network in the same code so that the device can switch between these two network.
But I noticed that switching between network took 2 min 20 seconds. The "AzureTimerEventHandler" restarted when there was no data sending from device to HUB. This took around 2min 20 seconds.

How can I make the device switch its network immediately without waiting for a long time.

Thank you.

Azure Sphere
Azure Sphere
An Azure internet of things security solution including hardware, operating system, and cloud components.
171 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 35,971 Reputation points Moderator
    2021-12-24T16:17:18.653+00:00

    @95504669 Thanks for sharing the additional information. You will get IOTHUB_CLIENT_CONNECTION_RETRY_EXPIRED message when the maximum retry time is expired to reconnect the IoT hub client.

    The Azure IoT Hub Client has a feature called RetryPolicy (which can be set using IotHubClient_SetRetryPolicy). It has a property that limits the maximum time the client can attempt to reconnect when failures occur. If that maximum time is reached, the Connection Status is invoked with status UNAUTHENTICATED and reason RETRY_EXPIRED.

    Please see Connection and retry for Retry patterns for more details.

    Regarding AzureTimerEventHandler and network switch delay, since there are no exact details available and/or logged, I suggest you please file a support request @ https://aka.ms/azsupt? Please let me know if you do not have a support plan.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.