java.net
public interface SocketOptions
SocketImpl
and
DatagramSocketImpl
to implement options
on sockets.Modifier and Type | Field and Description |
---|---|
static int |
IP_MULTICAST_IF
Options id for the IP_MULTICAST_IF value
|
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
Retrieve the local address to which the socket is bound.
|
static int |
SO_BROADCAST
Sets SO_BROADCAST for a socket
|
static int |
SO_KEEPALIVE
Option id for the SO_KEEPALIVE value
|
static int |
SO_LINGER
Option id for the SO_LINGER value
|
static int |
SO_OOBINLINE
Sets SO_OOBINLINE for a socket
|
static int |
SO_RCVBUF
Option id for the receive buffer size
|
static int |
SO_REUSEADDR
Sets the SO_REUSEADDR parameter on a socket
|
static int |
SO_SNDBUF
Option id for the send buffer size
|
static int |
SO_TIMEOUT
Option id for the SO_TIMEOUT value
|
static int |
TCP_NODELAY
Option id for the TCP_NODELAY value
|
static final int SO_KEEPALIVE
static final int SO_LINGER
static final int SO_TIMEOUT
static final int SO_BINDADDR
static final int SO_SNDBUF
static final int SO_RCVBUF
static final int SO_REUSEADDR
static final int SO_BROADCAST
static final int SO_OOBINLINE
static final int TCP_NODELAY
static final int IP_MULTICAST_IF
static final int IP_MULTICAST_IF2
static final int IP_MULTICAST_LOOP
static final int IP_TOS
void setOption(int optionId, Object val) throws SocketException
Integer
. For options that are set to on or off, the
value passed will be a Boolean
. The optionId
parameter is one of the defined constants in this interface.optionId
- The identifier of the optionval
- The value to set the option toSocketException
- If an error occursObject getOption(int optionId) throws SocketException
Object
returned will be an Integer
for options
that have integer values. For options that are set to on or off, a
Boolean
will be returned. The optionId
parameter is one of the defined constants in this interface.optionId
- The option identifierSocketException
- If an error occurs