org.apache.commons.net
public final class DaytimeUDPClient extends DatagramSocketClient
open
and call getTime
to retrieve the daytime
string, then
call close
to close the connection properly. Unlike
DaytimeTCPClient,
successive calls to getTime
are permitted
without re-establishing a connection. That is because UDP is a
connectionless protocol and the Daytime protocol is stateless.
Field Summary | |
---|---|
static int | DEFAULT_PORT The default daytime port. |
Method Summary | |
---|---|
String | getTime(InetAddress host, int port)
Retrieves the time string from the specified server and port and
returns it.
|
String | getTime(InetAddress host) Same as getTime(host, DaytimeUDPClient.DEFAULT_PORT); ** |
Parameters: host The address of the server. port The port of the service.
Returns: The time string.
Throws: IOException If an error occurs while retrieving the time.
getTime(host, DaytimeUDPClient.DEFAULT_PORT);
**