Module java.base
Package java.net

Interface SocketOptions

  • All Known Implementing Classes:
    DatagramSocketImpl, SocketImpl


    public interface SocketOptions
    Interface of methods to get/set socket options. This interface is implemented by: SocketImpl and DatagramSocketImpl. Subclasses of these should override the methods of this interface in order to support their own options.

    The methods and constants which specify options in this interface are for implementation only. If you're not subclassing SocketImpl or DatagramSocketImpl, you won't use these directly. There are type-safe methods to get/set each of these options in Socket, ServerSocket, DatagramSocket and MulticastSocket.

    Since:
    1.1
    • 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_REUSEPORT
      Sets SO_REUSEPORT for a socket.
      static int