azure-c-shared-utility icon indicating copy to clipboard operation
azure-c-shared-utility copied to clipboard

"Operating mode must not be set while SNTP client is running" if SNTP has already been initialized

Open dmitriychernenko opened this issue 7 years ago • 2 comments

Hi, I explicitly initialize SNTP in my project (my existing code needs time). I've tried to use Azure IoT SDK to talk to Azure IoT hub. App crashes with following error message: "Operating mode must not be set while SNTP client is running". I believe this caused by this code https://github.com/Azure/azure-c-shared-utility/blob/694116b047f86bac28375d571e016a01d90eaa1b/pal/lwip/sntp_lwip.c#L39

dmitriychernenko avatar Apr 07 '19 02:04 dmitriychernenko

Hi Dimitry,

Did you find any solution to this problem? I'm facing the same issue while connecting a device throught a transparent gatewa that is not providing public internet routing. Since no internet is available on device, it fails to get NTP from pool.npt...

So I configured sntp to get time from my gateway on my device code like this:

    sntp_setoperatingmode(SNTP_OPMODE_POLL);
    sntp_setservername(0, "192.168.10.1");
    sntp_init();

Hope tha this case is possible...

kbeaugrand avatar Sep 28 '20 06:09 kbeaugrand