Java Reference
In-Depth Information
localAddr
Local address; use null to specify using the default local
address
localPort
Local port; a localPort of 0 allows the constructor to pick any
available port
Operators
void close ()
Closes the TCP socket and its I/O streams.
void shutdownInput ()
Closes the input side of a TCP stream. Any unread data is silently discarded, including
data buffered by the socket, data in transit, and data arriving in the future. Any subse-
quent attempt to read from the socket will return end-of-stream ( 1); any subsequent
call to getInputStream() will cause an IOException to be thrown (see Section 4.5).
void shutdownOutput ()
Closes the output side of a TCP stream. The implementation will attempt to deliver any
data already written to the socket's output stream to the other end. Any subsequent
attempt to write to the socket's output stream or to call getOutputStream() will cause
an IOException to be thrown (see Section 4.5).
Accessors/Mutators
InetAddress getInetAddress ()
int getPort ()
Returns the remote socket address/port.
InputStream getInputStream ()
OutputStream getOutputStream ()
Returns a stream for reading/writing bytes from/to the socket.
boolean getKeepAlive ()
void setKeepAlive ( boolean on )
Returns/sets keepalive message behavior. If keepalive is enabled, TCP sends a probe
to the other end of the connection when no data has been exchanged for a system-
dependent amount of time (usually two hours). If the remote socket is still alive, it
will acknowledge the probe (invisible to the application). However, if the other end
fails to acknowledge several probes in a row, the local TCP closes the connection, and
subsequent operations on it will throw an exception. Keepalive is disabled by default.
on
If true ( false ), enable (disable) keepalive.
Search WWH ::




Custom Search