public final class NTPUDPClient extends DatagramSocketClient
| Modifier and Type | Field | Description |
|---|---|---|
static int |
DEFAULT_PORT |
The default NTP port.
|
_isOpen_, _socket_, _socketFactory_, _timeout_| Constructor | Description |
|---|---|
NTPUDPClient() |
| Modifier and Type | Method | Description |
|---|---|---|
TimeInfo |
getTime(java.net.InetAddress host) |
Retrieves the time information from the specified server on the
default NTP port and returns it.
|
TimeInfo |
getTime(java.net.InetAddress host,
int port) |
Retrieves the time information from the specified server and port and
returns it.
|
int |
getVersion() |
Returns the NTP protocol version number that client sets on request packet
that is sent to remote host (e.g.
|
void |
setVersion(int version) |
Sets the NTP protocol version number that client sets on request packet
communicate with remote host.
|
close, getDefaultTimeout, getLocalAddress, getLocalPort, getSoTimeout, isOpen, open, open, open, setDatagramSocketFactory, setDefaultTimeout, setSoTimeoutpublic static final int DEFAULT_PORT
public TimeInfo getTime(java.net.InetAddress host, int port) throws java.io.IOException
host - The address of the server.port - The port of the service.java.io.IOException - If an error occurs while retrieving the time.public TimeInfo getTime(java.net.InetAddress host) throws java.io.IOException
host - The address of the server.java.io.IOException - If an error occurs while retrieving the time.public int getVersion()
setVersion(int)public void setVersion(int version)
version - the NTP protocol version number