public final class DaytimeTCPClient extends SocketClient
connect
and call getTime()
to retrieve the daytime
string, then
call disconnect
to close the connection properly.
DaytimeUDPClient
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PORT
The default daytime port.
|
_defaultPort_, _input_, _isConnected_, _output_, _socket_, _socketFactory_, _timeout_, NETASCII_EOL
Constructor and Description |
---|
DaytimeTCPClient()
The default DaytimeTCPClient constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getTime()
Retrieves the time string from the server and returns it.
|
_connectAction_, connect, connect, connect, connect, connect, connect, disconnect, getDefaultPort, getDefaultTimeout, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSoLinger, getSoTimeout, getTcpNoDelay, isConnected, setDefaultPort, setDefaultTimeout, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote
public static final int DEFAULT_PORT
public DaytimeTCPClient()
DEFAULT_PORT
.public java.lang.String getTime() throws java.io.IOException
disconnect
after calling this method. To retrieve another time, you must
initiate another connection with
connect
before calling getTime()
again.
java.io.IOException
- If an error occurs while fetching the time string.