Class NTPClient
- java.lang.Object
-
- org.apache.commons.net.examples.ntp.NTPClient
-
public final class NTPClient extends java.lang.ObjectThis is an example program demonstrating how to use the NTPUDPClient class. This program sends a Datagram client request packet to a Network time Protocol (NTP) service port on a specified server, retrieves the time, and prints it to standard output along with the fields from the NTP message header (e.g. stratum level, reference id, poll interval, root delay, mode, ...) See the spec for details.Usage: NTPClient
<hostname-or-address-list>Example: NTPClient clock.psu.edu
-
-
Field Summary
Fields Modifier and Type Field Description private static java.text.NumberFormatnumberFormatprivate static java.lang.StringOWN_CLOCK_IP_ADDRESS
-
Constructor Summary
Constructors Constructor Description NTPClient()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)static voidprocessResponse(TimeInfo info)ProcessTimeInfoobject and print its details.
-
-
-
Field Detail
-
OWN_CLOCK_IP_ADDRESS
private static final java.lang.String OWN_CLOCK_IP_ADDRESS
- See Also:
- Constant Field Values
-
numberFormat
private static final java.text.NumberFormat numberFormat
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
-
processResponse
public static void processResponse(TimeInfo info)
ProcessTimeInfoobject and print its details.- Parameters:
info-TimeInfoobject.
-
-