Uses of Interface java.net.SocketOption (Java SE 25 & JDK 25)
Description: use: module: java.base, package: java.net, interface: SocketOption

# Uses of Interface
java.net.SocketOption

Packages that use SocketOption
Package
Description
com.sun.nio.sctp
A Java API for Stream Control Transport Protocol.
java.net
Provides the classes for implementing networking applications.
java.nio.channels
Defines channels, which represent connections to entities that are capable of performing I/O operations, such as files and sockets; defines selectors, for multiplexed, non-blocking I/O operations.
jdk.net
Platform specific socket options for the `java.net` and `java.nio.channels` socket classes.

- ## Uses of SocketOption in com.sun.nio.sctp

  Subinterfaces of SocketOption in com.sun.nio.sctp
  Modifier and Type
  Interface
  Description
  `interface`
  `SctpSocketOption<T>`
  A socket option associated with an SCTP channel.

- ## Uses of SocketOption in java.net

  Fields in java.net declared as SocketOption
  Modifier and Type
  Field
  Description
  `static final SocketOption<NetworkInterface>`
  StandardSocketOptions.`IP_MULTICAST_IF`
  The network interface for Internet Protocol (IP) multicast datagrams.
  `static final SocketOption<Boolean>`
  StandardSocketOptions.`IP_MULTICAST_LOOP`
  Loopback for Internet Protocol (IP) multicast datagrams.
  `static final SocketOption<Integer>`
  StandardSocketOptions.`IP_MULTICAST_TTL`
  The time-to-live for Internet Protocol (IP) multicast datagrams.
  `static final SocketOption<Integer>`
  StandardSocketOptions.`IP_TOS`
  The Type of Service (ToS) octet in the Internet Protocol (IP) header.
  `static final SocketOption<Boolean>`
  StandardSocketOptions.`SO_BROADCAST`
  Allow transmission of broadcast datagrams.
  `static final SocketOption<Boolean>`
  StandardSocketOptions.`SO_KEEPALIVE`
  Keep connection alive.
  `static final SocketOption<Integer>`
  StandardSocketOptions.`SO_LINGER`
  Linger on close if data is present.
  `static final SocketOption<Integer>`
  StandardSocketOptions.`SO_RCVBUF`
  The size of the socket receive buffer.
  `static final SocketOption<Boolean>`
  StandardSocketOptions.`SO_REUSEADDR`
  Re-use address.
  `static final SocketOption<Boolean>`
  StandardSocketOptions.`SO_REUSEPORT`
  Re-use port.
  `static final SocketOption<Integer>`
  StandardSocketOptions.`SO_SNDBUF`
  The size of the socket send buffer.
  `static final SocketOption<Boolean>`
  StandardSocketOptions.`TCP_NODELAY`
  Disable the Nagle algorithm.
  Methods in java.net that return types with arguments of type SocketOption
  Modifier and Type
  Method
  Description
  `Set<SocketOption<?>>`
  DatagramSocket.`supportedOptions()`
  Returns a set of the socket options supported by this socket.
  `protected Set<SocketOption<?>>`
  DatagramSocketImpl.`supportedOptions()`
  Returns a set of SocketOptions supported by this impl and by this impl's socket (DatagramSocket or MulticastSocket)
  `Set<SocketOption<?>>`
  ServerSocket.`supportedOptions()`
  Returns a set of the socket options supported by this server socket.
  `Set<SocketOption<?>>`
  Socket.`supportedOptions()`
  Returns a set of the socket options supported by this socket.
  `protected Set<SocketOption<?>>`
  SocketImpl.`supportedOptions()`
  Returns a set of SocketOptions supported by this impl and by this impl's socket (Socket or ServerSocket)
  Methods in java.net with parameters of type SocketOption
  Modifier and Type
  Method
  Description
  `<T> T`
  DatagramSocket.`getOption(SocketOption<T> name)`
  Returns the value of a socket option.
  `protected <T> T`
  DatagramSocketImpl.`getOption(SocketOption<T> name)`
  Called to get a socket option.
  `<T> T`
  ServerSocket.`getOption(SocketOption<T> name)`
  Returns the value of a socket option.
  `<T> T`
  Socket.`getOption(SocketOption<T> name)`
  Returns the value of a socket option.
  `protected <T> T`
  SocketImpl.`getOption(SocketOption<T> name)`
  Called to get a socket option.
  `<T> DatagramSocket`
  DatagramSocket.`setOption(SocketOption<T> name, T value)`
  Sets the value of a socket option.
  `protected <T> void`
  DatagramSocketImpl.`setOption(SocketOption<T> name, T value)`
  Called to set a socket option.
  `<T> ServerSocket`
  ServerSocket.`setOption(SocketOption<T> name, T value)`
  Sets the value of a socket option.
  `<T> Socket`
  Socket.`setOption(SocketOption<T> name, T value)`
  Sets the value of a socket option.
  `protected <T> void`
  SocketImpl.`setOption(SocketOption<T> name, T value)`
  Called to set a socket option.

- ## Uses of SocketOption in java.nio.channels

  Methods in java.nio.channels that return types with arguments of type SocketOption
  Modifier and Type
  Method
  Description
  `Set<SocketOption<?>>`
  NetworkChannel.`supportedOptions()`
  Returns a set of the socket options supported by this channel.
  Methods in java.nio.channels with parameters of type SocketOption
  Modifier and Type
  Method
  Description
  `<T> T`
  NetworkChannel.`getOption(SocketOption<T> name)`
  Returns the value of a socket option.
  `abstract <T> AsynchronousServerSocketChannel`
  AsynchronousServerSocketChannel.`setOption(SocketOption<T> name, T value)`
  `abstract <T> AsynchronousSocketChannel`
  AsynchronousSocketChannel.`setOption(SocketOption<T> name, T value)`
  `abstract <T> DatagramChannel`
  DatagramChannel.`setOption(SocketOption<T> name, T value)`
  `<T> NetworkChannel`
  NetworkChannel.`setOption(SocketOption<T> name, T value)`
  Sets the value of a socket option.
  `abstract <T> ServerSocketChannel`
  ServerSocketChannel.`setOption(SocketOption<T> name, T value)`
  `abstract <T> SocketChannel`
  SocketChannel.`setOption(SocketOption<T> name, T value)`

- ## Uses of SocketOption in jdk.net

  Fields in jdk.net declared as SocketOption
  Modifier and Type
  Field
  Description
  `static final SocketOption<Boolean>`
  ExtendedSocketOptions.`IP_DONTFRAGMENT`
  Disable IP packet fragmentation.
  `static final SocketOption<Integer>`
  ExtendedSocketOptions.`SO_INCOMING_NAPI_ID`
  Identifies the receive queue that the last incoming packet for the socket was received on.
  `static final SocketOption<UnixDomainPrincipal>`
  ExtendedSocketOptions.`SO_PEERCRED`
  Unix Domain peer credentials.
  `static final SocketOption<Integer>`
  ExtendedSocketOptions.`TCP_KEEPCOUNT`
  Keep-Alive retransmission maximum limit.
  `static final SocketOption<Integer>`
  ExtendedSocketOptions.`TCP_KEEPIDLE`
  Keep-Alive idle time.
  `static final SocketOption<Integer>`
  ExtendedSocketOptions.`TCP_KEEPINTERVAL`
  Keep-Alive retransmission interval time.
  `static final SocketOption<Boolean>`
  ExtendedSocketOptions.`TCP_QUICKACK`
  Disable Delayed Acknowledgements.
  Methods in jdk.net that return types with arguments of type SocketOption
  Modifier and Type
  Method
  Description
  `static Set<SocketOption<?>>`
  Sockets.`supportedOptions(Class<?> socketType)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  use `Socket.supportedOptions()`, `ServerSocket.supportedOptions()`, or `DatagramSocket.supportedOptions()` instead.
  Methods in jdk.net with parameters of type SocketOption
  Modifier and Type
  Method
  Description
  `static <T> T`
  Sockets.`getOption(DatagramSocket s, SocketOption<T> name)`
  Deprecated.
  use `DatagramSocket.getOption(SocketOption)` instead.
  `static <T> T`
  Sockets.`getOption(ServerSocket s, SocketOption<T> name)`
  Deprecated.
  use `ServerSocket.getOption(SocketOption)` instead.
  `static <T> T`
  Sockets.`getOption(Socket s, SocketOption<T> name)`
  Deprecated.
  use `Socket.getOption(SocketOption)` instead.
  `static <T> void`
  Sockets.`setOption(DatagramSocket s, SocketOption<T> name, T value)`
  Deprecated.
  use `DatagramSocket.setOption(SocketOption, Object)` instead.
  `static <T> void`
  Sockets.`setOption(ServerSocket s, SocketOption<T> name, T value)`
  Deprecated.
  use `ServerSocket.setOption(SocketOption, Object)` instead.
  `static <T> void`
  Sockets.`setOption(Socket s, SocketOption<T> name, T value)`
  Deprecated.
  use `Socket.setOption(SocketOption, Object)` instead.