GeezerVison is showing docs.oracle.com — SocketOptions (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.net
Interface SocketOptions
-
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
static int |
IP_MULTICAST_IF |
Set which outgoing interface on which to send multicast packets.
|
static int |
IP_MULTICAST_IF2 |
Same as above.
|
static int |
IP_MULTICAST_LOOP |
This option enables or disables local loopback of multicast datagrams.
|
static int |
IP_TOS |
This option sets the type-of-service or traffic class field
in the IP header for a TCP or UDP socket.
|
static int |
SO_BINDADDR |
Fetch the local address binding of a socket (this option cannot
be "set" only "gotten", since sockets are bound at creation time,
and so the locally bound address cannot be changed).
|
static int |
SO_BROADCAST |
Sets SO_BROADCAST for a socket.
|
static int |
SO_KEEPALIVE |
When the keepalive option is set for a TCP socket and no data
has been exchanged across the socket in either direction for
2 hours (NOTE: the actual value is implementation dependent),
TCP automatically sends a keepalive probe to the peer.
|
static int |
SO_LINGER |
Specify a linger-on-close timeout.
|
static int |
SO_OOBINLINE |
When the OOBINLINE option is set, any TCP urgent data received on
the socket will be received through the socket input stream.
|
static int |
SO_RCVBUF |
Set a hint the size of the underlying buffers used by the
platform for incoming network I/O.
|
static int |
SO_REUSEADDR |
Sets SO_REUSEADDR for a socket.
|
static int |
SO_SNDBUF |
Set a hint the size of the underlying buffers used by the
platform for outgoing network I/O.
|
static int |
SO_TIMEOUT |
Set a timeout on blocking Socket operations:
|
static int |
TCP_NODELAY |
Disable Nagle's algorithm for this connection.
|
-
Method Summary
All Methods Instance Methods Abstract Methods
| Modifier and Type |
Method |
Description |
Object |
getOption(int optID) |
Fetch the value of an option.
|
void |
setOption(int optID,
Object value) |
Enable/disable the option specified by optID.
|
-
-
Field Detail
-
SO_BROADCAST
@Native
static final int SO_BROADCAST
Sets SO_BROADCAST for a socket. This option enables and disables
the ability of the process to send broadcast messages. It is supported
for only datagram sockets and only on networks that support
the concept of a broadcast message (e.g. Ethernet, token ring, etc.),
and it is set by default for DatagramSockets.
- Since:
- 1.4
- See Also:
- Constant Field Values
-
SO_KEEPALIVE
@Native
static final int SO_KEEPALIVE
When the keepalive option is set for a TCP socket and no data
has been exchanged across the socket in either direction for
2 hours (NOTE: the actual value is implementation dependent),
TCP automatically sends a keepalive probe to the peer. This probe is a
TCP segment to which the peer must respond.
One of three responses is expected:
1. The peer responds with the expected ACK. The application is not
notified (since everything is OK). TCP will send another probe
following another 2 hours of inactivity.
2. The peer responds with an RST, which tells the local TCP that
the peer host has crashed and rebooted. The socket is closed.
3. There is no response from the peer. The socket is closed.
The purpose of this option is to detect if the peer host crashes.
Valid only for TCP socket: SocketImpl
- See Also:
Socket.setKeepAlive(boolean),
Socket.getKeepAlive(),
Constant Field Values
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|