|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
| Method Summary | |
void |
close()
Closes the SimpleSocket. |
InetAddress |
getInetAddress()
Gets the remote IP address to which the SimpleSocket is
connected. |
InputStream |
getInputStream()
Gets the input stream of the SimpleSocket. |
OutputStream |
getOutputStream()
Gets the output stream of the SimpleSocket. |
int |
getPort()
Gets the remote port to which the SimpleSocket is
connected. |
int |
getSoTimeout()
Gets the SO_TIMEOUT int value. |
boolean |
getTcpNoDelay()
Gets the TCP_NODELAY boolean value. |
void |
setSoTimeout(int timeout)
Sets the SO_TIMEOUT to the specified timeout
in milliseconds. |
void |
setTcpNoDelay(boolean on)
Sets the TCP_NODELAY to the specified on
boolean. |
boolean |
useIp()
Checks to see if the SimpleSocket needs to use the IP
(Internet Protocol). |
| Method Detail |
public void close()
throws IOException
Closes the SimpleSocket.
Any thread currently blocked in an I/O operation upon the
SimpleSocket will throw a
.SocketException
Once the SimpleSocket has been closed, it is not
available for further networking use. A new SimpleSocket
needs to be created.
IOException - if an I/O error occurs when closing the
SimpleSocket.public InetAddress getInetAddress()
Gets the remote IP address to which the SimpleSocket is
connected.
public int getPort()
Gets the remote port to which the SimpleSocket is
connected.
public InputStream getInputStream()
throws IOException
Gets the input stream of the SimpleSocket.
IOException - if an I/O error occurs when creating the input stream or
the SimpleSocket is closed.getOutputStream()
public OutputStream getOutputStream()
throws IOException
Gets the output stream of the SimpleSocket.
IOException - if an I/O error occurs when creating the output stream or
the SimpleSocket is closed.getInputStream()
public int getSoTimeout()
throws SocketException
Gets the SO_TIMEOUT int value. 0 implies
that the option is disabled (i.e., a timeout of infinity).
SO_TIMEOUT int value.
SocketException - if there is an error in the underlying protocol, such as
a TCP error.setSoTimeout(int)
public boolean getTcpNoDelay()
throws SocketException
Gets the TCP_NODELAY boolean value.
true if TCP_NODELAY is enabled,
false if not.
SocketException - if there is an error in the underlying protocol, such as
a TCP error.setTcpNoDelay(boolean)
public void setSoTimeout(int timeout)
throws IllegalArgumentException,
SocketException
Sets the SO_TIMEOUT to the specified timeout
in milliseconds.
With this option set to a non-zero timeout, a read() call on the
InputStream associated with the SimpleSocket
will block for only this amount of time. If the timeout expires, a
SocketTimeoutException is raised, though the
SimpleSocket is still valid. The option must be
enabled prior to entering the blocking operation to have effect. A
timeout of zero is interpreted as an infinite timeout.
timeout - the new timeout in milliseconds.
IllegalArgumentException - if the specified timeout is lesser than
0.
SocketException - if there is an error in the underlying protocol, such as
a TCP error.getSoTimeout()
public void setTcpNoDelay(boolean on)
throws SocketException
Sets the TCP_NODELAY to the specified on
boolean. This will disable/enable Nagle's algorithm.
on - true to enable TCP_NODELAY,
false to disable.
SocketException - if there is an error in the underlying protocol, such as
a TCP error.getTcpNoDelay()public boolean useIp()
Checks to see if the SimpleSocket needs to use the IP
(Internet Protocol).
true if the SimpleSocket needs to
use the IP, false if not.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||