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 13 per RFC 867.
|
_defaultPort_, _hostname_, _input_, _output_, _serverSocketFactory_, _socket_, _socketFactory_, _timeout_, connectTimeout, NETASCII_EOL, remoteInetSocketAddress| Constructor and Description |
|---|
DaytimeTCPClient()
The default DaytimeTCPClient constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getTime()
Gets the time string from the server and returns it.
|
_connectAction_, addProtocolCommandListener, applySocketAttributes, checkOpenOutputStream, connect, connect, connect, connect, connect, connect, createCommandSupport, disconnect, fireCommandSent, fireReplyReceived, getCharset, getCommandSupport, getConnectTimeout, getDefaultPort, getDefaultTimeout, getHostAddress, getHostAddress, getKeepAlive, getLocalAddress, getLocalPort, getProxy, getReceiveBufferSize, getRemoteAddress, getRemoteInetSocketAddress, getRemotePort, getSendBufferSize, getServerSocketFactory, getSoLinger, getSoTimeout, getTcpNoDelay, isAvailable, isConnected, removeProtocolCommandListener, setCharset, setConnectTimeout, setDefaultPort, setDefaultTimeout, setKeepAlive, setProxy, setReceiveBufferSize, setSendBufferSize, setServerSocketFactory, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemotepublic static final int DEFAULT_PORT
public DaytimeTCPClient()
DEFAULT_PORT.public String getTime() throws IOException
disconnect after calling this method. To retrieve another time, you must initiate another
connection with connect before calling getTime() again.IOException - If an error occurs while fetching the time string.