AnsweredAssumed Answered

RTCS SNTP Always Timeout

Question asked by Muhammad Waqas Athar on Nov 15, 2012
Latest reply on Dec 19, 2012 by Alexandru Nan

Hello users,

 

I am trying to use SNTP_oneshot to fetch the time on system start , but i always get timeout , i do not understand what is wrong ,I have initilized my network before using sntp_oneshot, i tried using the same code and tested with my local ip just to see wheather ntp request reach the destination or not.It does reach the destination , attached is the image showing packets captured using wireshark.It timeouts even with any public ntp server.Could anyone suggest what might be wrong.

 

In attached image :

IP OF MQX : 192.168.10.6

IP OF WINDOWS MACHINE : 192.168.10.19 

 

Here is the code,

 

     // Set The time using SNTP  // 192.168.10.19 ip of windows machine which possibly has ntp server

   printf("Fetching Time\n");

  error = SNTP_oneshot(inet_addr("192.168.10.19"),20000);

  if (error!=RTCS_OK){      // IF some error print it

   if(error==RTCSERR_TIMEOUT)

     printf("SNTP Timeout\n");

 

  }

 

ntp.JPG

Outcomes