Java Reference
In-Depth Information
InetAddress
getLocalAddress
()
int
getLocalPort
()
Returns the local socket address/port.
int
getReceiveBufferSize
()
int
getSendBufferSize
()
void
setReceiveBufferSize
(
int
size
)
void
setSendBufferSize
(
int
size
)
Returns/sets the size of the send/receive buffer for the socket (see Section 4.4).
size
Number of bytes to allocate for the socket send/receive
buffer
int
getSoLinger
()
void
setSoLinger
(
boolean
on
,
int
linger
)
Returns/sets the maximum amount of time (in milliseconds) that
close()
will block
waiting for all data to be delivered.
getSoLinger()
returns
−
1 if lingering is disabled
(see Section 5.4). Lingering is off by default.
on
If
true
, the socket lingers on
close()
. up to the maximum
specified time.
linger
The maximum amount of time (milliseconds) a socket lingers
on
close()
int
getSoTimeout
()
void
setSoTimeout
(
int
timeout
)
Returns/sets the maximum amount of time that a
read()
on this socket will block. If
the specified number of milliseconds elapses before any data is available, an
Inter−
ruptedIOException
is thrown (see Section 4.2).
timeout
The maximum time (milliseconds) to wait for data on a
read()
. The value 0 (the default) indicates that there is no
time limit, meaning that a read will not return until data is
available.
boolean
getTcpNoDelay
()
void
setTcpNoDelay
(
boolean
on
)
Returns/sets whether the Nagle algorithm to coalesce TCP packets is disabled. To avoid
small TCP packets, which make inecient use of network resources, Nagle's algorithm
(enabled by default) delays packet transmission under certain conditions to improve
the opportunities to coalesce bytes from several writes into a single TCP packet. This
delay is unacceptable to some types of interactive applications.
on
If
true
(
false
), disable (enable) Nagle's algorithm.
Search WWH ::
Custom Search