| java.lang.Object org.apache.commons.net.SocketClient org.apache.commons.net.TimeTCPClient
Field Summary | |
final public static int | DEFAULT_PORT The default time port. | final public static long | SECONDS_1900_TO_1970 The number of seconds between 00:00 1 January 1900 and
00:00 1 January 1970. |
Constructor Summary | |
public | TimeTCPClient() The default TimeTCPClient constructor. |
Method Summary | |
public Date | getDate() Retrieves the time from the server and returns a Java Date
containing the time converted to the local timezone.
The server will have closed the connection at this point, so you should
call
org.apache.commons.net.SocketClient.disconnect disconnect after calling this method. | public long | getTime() Retrieves the time from the server and returns it. |
DEFAULT_PORT | final public static int DEFAULT_PORT(Code) | | The default time port. It is set to 37 according to RFC 868. **
|
SECONDS_1900_TO_1970 | final public static long SECONDS_1900_TO_1970(Code) | | The number of seconds between 00:00 1 January 1900 and
00:00 1 January 1970. This value can be useful for converting
time values to other formats.
|
TimeTCPClient | public TimeTCPClient()(Code) | | The default TimeTCPClient constructor. It merely sets the default
port to DEFAULT_PORT .
|
getDate | public Date getDate() throws IOException(Code) | | Retrieves the time from the server and returns a Java Date
containing the time converted to the local timezone.
The server will have closed the connection at this point, so you should
call
org.apache.commons.net.SocketClient.disconnect disconnect after calling this method. To retrieve another time, you must
initiate another connection with
org.apache.commons.net.SocketClient.connect connect before calling getDate() again.
A Date value containing the time retrieved from the serverconverted to the local timezone. exception: IOException - If an error occurs while fetching the time. |
getTime | public long getTime() throws IOException(Code) | | Retrieves the time from the server and returns it. The time
is the number of seconds since 00:00 (midnight) 1 January 1900 GMT,
as specified by RFC 868. This method reads the raw 32-bit big-endian
unsigned integer from the server, converts it to a Java long, and
returns the value.
The server will have closed the connection at this point, so you should
call
org.apache.commons.net.SocketClient.disconnect disconnect after calling this method. To retrieve another time, you must
initiate another connection with
org.apache.commons.net.SocketClient.connect connect before calling getTime() again.
The time value retrieved from the server. exception: IOException - If an error occurs while fetching the time. |
Methods inherited from org.apache.commons.net.SocketClient | protected void _connectAction_() throws IOException(Code)(Java Doc) public void connect(InetAddress host, int port) throws SocketException, IOException(Code)(Java Doc) public void connect(String hostname, int port) throws SocketException, IOException(Code)(Java Doc) public void connect(InetAddress host, int port, InetAddress localAddr, int localPort) throws SocketException, IOException(Code)(Java Doc) public void connect(String hostname, int port, InetAddress localAddr, int localPort) throws SocketException, IOException(Code)(Java Doc) public void connect(InetAddress host) throws SocketException, IOException(Code)(Java Doc) public void connect(String hostname) throws SocketException, IOException(Code)(Java Doc) public void disconnect() throws IOException(Code)(Java Doc) public int getDefaultPort()(Code)(Java Doc) public int getDefaultTimeout()(Code)(Java Doc) public InetAddress getLocalAddress()(Code)(Java Doc) public int getLocalPort()(Code)(Java Doc) public InetAddress getRemoteAddress()(Code)(Java Doc) public int getRemotePort()(Code)(Java Doc) public int getSoLinger() throws SocketException(Code)(Java Doc) public int getSoTimeout() throws SocketException(Code)(Java Doc) public boolean getTcpNoDelay() throws SocketException(Code)(Java Doc) public boolean isConnected()(Code)(Java Doc) public void setDefaultPort(int port)(Code)(Java Doc) public void setDefaultTimeout(int timeout)(Code)(Java Doc) public void setSoLinger(boolean on, int val) throws SocketException(Code)(Java Doc) public void setSoTimeout(int timeout) throws SocketException(Code)(Java Doc) public void setSocketFactory(SocketFactory factory)(Code)(Java Doc) public void setTcpNoDelay(boolean on) throws SocketException(Code)(Java Doc) public boolean verifyRemote(Socket socket)(Code)(Java Doc)
|
|
|