| Field Summary | |
|---|---|
| static String |
The end of line character sequence used by most IETF protocols. |
| protected int |
The default port the client should connect to. |
| protected InputStream |
The socket's InputStream. |
| protected boolean |
A status variable indicating if the client's socket is currently open. |
| protected OutputStream |
The socket's OutputStream. |
| protected SocketFactory |
The socket's SocketFactory. |
| protected Socket |
The socket used for the connection. |
| protected int |
The timeout to use after opening a socket. |
| Constructor Summary |
|---|
|
Default constructor for SocketClient. |
| Method Summary | |
|---|---|
| void |
Opens a Socket connected to a remote host at the specified port and originating from the current host at a system assigned port. |
| void |
Opens a Socket connected to a remote host at the specified port and originating from the current host at a system assigned port. |
| void |
Opens a Socket connected to a remote host at the specified port and originating from the specified local address and port. |
| void |
Opens a Socket connected to a remote host at the specified port and originating from the specified local address and port. |
| void |
Opens a Socket connected to a remote host at the current default port and originating from the current host at a system assigned port. |
| void |
Opens a Socket connected to a remote host at the current default port and originating from the current host at a system assigned port. |
| void |
Disconnects the socket connection. |
| int |
Returns the current value of the default port (stored in _defaultPort_ ). |
| int |
Returns the default timeout in milliseconds that is used when opening a socket. |
| InetAddress |
Returns the local address to which the client's socket is bound. |
| int |
Returns the port number of the open socket on the local host used for the connection. |
| InetAddress |
No description provided. |
| int |
Returns the port number of the remote host to which the client is connected. |
| int |
Returns the current SO_LINGER timeout of the currently opened socket. |
| int |
Returns the timeout in milliseconds of the currently opened socket. |
| boolean |
Returns true if Nagle's algorithm is enabled on the currently opened socket. |
| boolean |
Returns true if the client is currently connected to a server. |
| void |
Sets the default port the SocketClient should connect to when a port is not specified. |
| void |
Set the default timeout in milliseconds to use when opening a socket. |
| void |
Sets the SocketFactory used by the SocketClient to open socket connections. |
| void |
Sets the SO_LINGER timeout on the currently opened socket. |
| void |
Set the timeout in milliseconds of a currently open connection. |
| void |
Enables or disables the Nagle's algorithm (TCP_NODELAY) on the currently opened socket. |
| boolean |
Verifies that the remote end of the given socket is connected to the the same host that the SocketClient is currently connected to. |
| protected void |
Because there are so many connect() methods, the _connectAction_() method is provided as a means of performing some action immediately after establishing a connection, rather than reimplementing all of the connect() methods. |
| Methods inherited from java.langObject |
|---|
protected
int
_defaultPort_
protected
boolean
_isConnected_
protected
int
_timeout_
public SocketClient
(
)
public
int
getDefaultPort
(
)
public
int
getDefaultTimeout
(
)
public
int
getLocalPort
(
)
public
int
getRemotePort
(
)
public
boolean
isConnected
(
)
public
void
setDefaultPort
(
int
port
)
public
void
setDefaultTimeout
(
int
timeout
)
This method sets the timeout on the just opened socket to the default timeout set by setDefaultTimeout() , sets _input_ and _output_ to the socket's InputStream and OutputStream respectively, and sets _isConnected_ to true.
Subclasses overriding this method should start by calling
super._connectAction_() first to ensure the
initialization of the aforementioned protected variables.