Hi,
I have written a code to use NTP to update the Spider clock. The first step is to get the IP address of the NTP server using a DNS request and the name of the NTP server.
The spider is connected to a router using a WIFI RS21 module. The routeur is connected to internet using a DSL line. The connection between the Spider and the router never fails, so the Spider always thinks it’s connected. But the DSL line sometimes fails and the DNS servers become unreachable.
The problem is that if the DSL line fails, the DNS.GetHostEntry seems to loop and starts to slow down the entire Spider so that it seems freezed, even though I have put the Network components in a separate thread.
Have you ever seen such a behavior ? Do you have a solution to this problem ?
Thanks.
Stephan.
Here is a code I use :
try
{
NTPTime.PrimaryServer = Dns.GetHostEntry(primaryNTPServer).AddressList[0].GetAddressBytes();
NTPTime.AlternateServer = Dns.GetHostEntry(secondaryNTPServer).AddressList[0].GetAddressBytes();
}
catch (Exception e)
{
DebugService.Print("NTPService : Exception on DNS lookup for NTP servers address");
DebugService.Print(e.Message);
}