Interface SocketConfigurator

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SocketConfigurator
Configures a Socket.

Use this to set socket options such as timeouts, keep-alive, TCP no-delay, and buffer sizes. For client sockets, the configurator is called before connecting so that options requiring pre-connect setup (e.g. SO_RCVBUF) are safely applied. For accepted server sockets, it is called after accept.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SocketConfigurator
    A no-op configurator that leaves the socket with default settings.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configure(Socket socket)
    Configures the given socket.
  • Field Details

    • DEFAULT

      static final SocketConfigurator DEFAULT
      A no-op configurator that leaves the socket with default settings.
  • Method Details

    • configure

      void configure(Socket socket) throws IOException
      Configures the given socket.
      Parameters:
      socket - the socket to configure
      Throws:
      IOException - if configuration fails