FileDocCategorySizeDatePackage
SocketOptions.javaAPI DocAndroid 1.5 API5954Wed May 06 22:41:04 BST 2009java.net

SocketOptions

public interface SocketOptions
Defines an interface for socket implementations to get and set socket options. It is implemented by the classes {@code SocketImpl} and {@code DatagramSocketImpl}.
see
SocketImpl
see
DatagramSocketImpl
since
Android 1.0

Fields Summary
public static final int
SO_LINGER
This option specifies the behavior of the {@code close()} method if there is still some buffered data to be sent while closing the socket. If the value of this option is set to {@code 0} the method closes the TCP socket forcefully and returns immediately. Is this value greater than {@code 0} the method blocks this time in milliseconds. If all data could be sent during this timeout the socket is closed normally otherwise forcefully. Valid values for this option are in the range {@code 0 <= SO_LINGER <= 65535}.
public static final int
SO_TIMEOUT
Timeout for blocking operations. The argument value is specified in milliseconds. An {@code InterruptedIOException} is thrown if this timeout expires.
public static final int
TCP_NODELAY
This option specifies whether data is sent immediately on this socket, as a side-effect though, this could lead to a low packet efficiency. The socket implementation uses the Nagle's algorithm to try to reach a higher packet efficiency if this option is disabled.
public static final int
IP_MULTICAST_IF
This option specifies the interface which is used to send multicast packets. It's only available on a {@code MulticastSocket}.
public static final int
SO_BINDADDR
This option can be used to set one specific interface on a multihomed host on which incoming connections are accepted. It's only available on server-side sockets.
public static final int
SO_REUSEADDR
This option specifies whether a reuse of a local address is allowed even if an other socket is not yet removed by the operating system. It's only available on a {@code MulticastSocket}.
public static final int
SO_SNDBUF
Buffer size of the outgoing channel.
public static final int
SO_RCVBUF
Buffer size of the incoming channel.
public static final int
SO_KEEPALIVE
This option specifies whether socket implementations can send keepalive messages if no data has been sent for a longer time.
public static final int
IP_TOS
This option specifies the value for the Type-of-Service (TOS) field of the IP header.
public static final int
IP_MULTICAST_LOOP
This option specifies whether the local loopback of multicast packets is enabled or disabled. This option is enabled by default on multicast sockets.
public static final int
SO_BROADCAST
This option can be used to enable broadcasting on datagram sockets.
public static final int
SO_OOBINLINE
This option specifies whether sending TCP urgent data is supported on this socket or not.
public static final int
IP_MULTICAST_IF2
This option can be used to set one specific interface on a multihomed host on which incoming connections are accepted. It's only available on server-side sockets. This option supports setting outgoing interfaces with either IPv4 or IPv6 addresses.
Constructors Summary
Methods Summary
public java.lang.ObjectgetOption(int optID)
Gets the value for the specified socket option.

return
the option value.
param
optID the option identifier.
throws
SocketException if an error occurs reading the option value.
since
Android 1.0

public voidsetOption(int optID, java.lang.Object val)
Sets the value of the specified socket option.

param
optID the option identifier.
param
val the value to be set for the option.
throws
SocketException if an error occurs setting the option value.
since
Android 1.0