public interface SocketOptions
SocketImpl
and DatagramSocketImpl
.SocketImpl
,
DatagramSocketImpl
Modifier and Type | Field and Description |
---|---|
static int |
IP_MULTICAST_IF
This is an IPv4-only socket option whose functionality is subsumed by
IP_MULTICAST_IF and not implemented on Android. |
static int |
IP_MULTICAST_IF2
This integer option sets the outgoing interface for multicast packets
using an interface index.
|
static int |
IP_MULTICAST_LOOP
This boolean option specifies whether the local loopback of multicast packets is
enabled or disabled.
|
static int |
IP_TOS
This integer option specifies the value for the type-of-service field of the IPv4 header,
or the traffic class field of the IPv6 header.
|
static int |
SO_BINDADDR
This option does not correspond to any Unix socket option and is not implemented on Android.
|
static int |
SO_BROADCAST
This boolean option can be used to enable broadcasting on datagram sockets.
|
static int |
SO_KEEPALIVE
This boolean option specifies whether the kernel sends keepalive messages.
|
static int |
SO_LINGER
Number of seconds to wait when closing a socket if there
is still some buffered data to be sent.
|
static int |
SO_OOBINLINE
This boolean option specifies whether sending TCP urgent data is supported on
this socket or not.
|
static int |
SO_RCVBUF
The size in bytes of a socket's receive buffer.
|
static int |
SO_REUSEADDR
This boolean option specifies whether a reuse of a local address is allowed even
if another socket is not yet removed by the operating system.
|
static int |
SO_SNDBUF
The size in bytes of a socket's send buffer.
|
static int |
SO_TIMEOUT
Integer timeout in milliseconds for blocking accept or read/receive operations (but not
write/send operations).
|
static int |
TCP_NODELAY
This boolean option specifies whether data is sent immediately on this socket.
|
static final int SO_LINGER
If this option is set to 0, the TCP socket is closed forcefully and the
call to close
returns immediately.
If this option is set to a value greater than 0, the value is interpreted as the number of seconds to wait. If all data could be sent during this time, the socket is closed normally. Otherwise the connection will be closed forcefully.
Valid values for this option are in the range 0 to 65535 inclusive. (Larger timeouts will be treated as 65535s timeouts; roughly 18 hours.)
static final int SO_TIMEOUT
An InterruptedIOException
is thrown if this timeout expires.
static final int TCP_NODELAY
static final int IP_MULTICAST_IF
IP_MULTICAST_IF
and not implemented on Android.static final int SO_BINDADDR
static final int SO_REUSEADDR
MulticastSocket
.static final int SO_SNDBUF
For datagram sockets, it is implementation-defined whether packets larger than this size can be sent.
static final int SO_RCVBUF
For datagram sockets, packets larger than this value will be discarded.
static final int SO_KEEPALIVE
static final int IP_TOS
See RFC 1349 for more about IPv4 and RFC 2460 for more about IPv6.
static final int IP_MULTICAST_LOOP
IP_MULTICAST_LOOP
.
See MulticastSocket.setLoopbackMode(boolean)
.static final int SO_BROADCAST
static final int SO_OOBINLINE
static final int IP_MULTICAST_IF2
Object getOption(int optID) throws SocketException
optID
- the option identifier.SocketException
- if an error occurs reading the option value.void setOption(int optID, Object val) throws SocketException
optID
- the option identifier.val
- the value to be set for the option.SocketException
- if an error occurs setting the option value.