xively / xively-client-c

The official and highly portable Xively C Client designed for embedded platforms.
Other
18 stars 22 forks source link

xi_bsp_time_cc3220sf_sntp fails to connect to SNTP server #204

Open Rhunter1 opened 5 years ago

Rhunter1 commented 5 years ago

System Information

Issue Intermittent issues where all 4 of the NTP servers hard coded in the Xively library fail. This causes a failure to connect to the broker. The 4 hard coded NTP servers that can be found in _xi_bsp_time_cc3220sfsntp.c are:

Below is an image of the debug output when the failure occurs: Issue

Rhunter1 commented 5 years ago

Looking into this further the error response -11 is SL_ERROR_BSD_EAGAIN. This error specifies to try the request again.

Would it be wise to poll each of the NTP servers multiple times?

If yes, would it be wise to decrease the SNTP receive timeout as it is currently set to 30 seconds?

DellaBitta commented 5 years ago

The implementation provided for the client was mean to be an example implementation. Please feel free to adapt its behavior to match your application's needs.

The goal of the NTP servers is to set the clock so that the device can properly validate the Xively service identifying certificate. The NTP servers in the source aren't necessarily the ones that you need to use. You could alter the list of servers, or , if the device already has accurate time, forgo the NTP lookup of time altogether.

My concern is: why are all of these different NTP servers failing connections at the same time?'  My hunch is that this is an issue where the LAN the device connects to does not have Internet connectivity, or there are other underlying networking issues which are causing the networking stack to return errors.

Iterating over each of the servers is something that you could certainly do, and that would be up to your desired behavior for the device. However this might just delay the inevitable that the device will fail its connection anyway, and you could contribute to an excessive amount of traffic on the LAN if the device attempts new connections to the NTP servers in a tight loop.