PClient reference design NTP Client

The pclient reference design implements a NTP Client using the oWL Pico API. The NTP Client an example on how to use UDP sockets in the oWL Pico API to create network applications.

NTP enables the host to connect to a remote NTP server to read the current time. In this example we’ll demonstrate how to use the ntp command to get the UTC time from an NTP server.

First establish the link and set the IP address as described in Commands :

$ linkup hdwireless
ok 0 (success)
link_cb: link:1
$ set_dhcp 1
addr_cb ip:192.168.2.101

On, http://tf.nist.gov/tf-cgi/servers.cgi, a number of public NTP servers are listed. We pick one and resolves its IP address with the get_hostbyname command:

$ get_hostbyname time-a.nist.gov
ok 0 (success)
lookup_cb: ip:129.6.15.28

Now use the ntp command to request the current time from the NTP server:

$ ntp 129.6.15.28
ok 0 (success)
ntp time: 2011-01-25 13:42:42

For information on the implementation of the HTTP server and for details on how to modify and tailor the NTP client solution, see the source code in the files wlp_ntp.c and wlp_ntp.h of the reference design.

Topic revision: r1 - 2015-08-27 - 07:57:31 - AndersGrahn

Log In (Admin Only)

 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback