org.apache.tomcat.util.net

## Interface ServerSocketFactory

- All Known Implementing Classes:
    DefaultServerSocketFactory, JSSESocketFactory

      public interface ServerSocketFactory

  The common interface through which the `JIoEndpoint` interacts with both non-SSL and SSL sockets.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.net.Socket` | `acceptSocket(java.net.ServerSocket socket)` Wrapper function for accept().
    `java.net.ServerSocket` | `createSocket(int port)` Returns a server socket which uses all network interfaces on the host, and is bound to a the specified port.
    `java.net.ServerSocket` | `createSocket(int port, int backlog)` Returns a server socket which uses all network interfaces on the host, is bound to a the specified port, and uses the specified connection backlog.
    `java.net.ServerSocket` | `createSocket(int port, int backlog, java.net.InetAddress ifAddress)` Returns a server socket which uses only the specified network interface on the local host, is bound to a the specified port, and uses the specified connection backlog.
    `void` | `handshake(java.net.Socket sock)` Triggers the SSL handshake.

- - ### Method Detail

    - #### createSocket

          java.net.ServerSocket createSocket(int port)
                                             throws java.io.IOException,
                                                    java.lang.InstantiationException

      Returns a server socket which uses all network interfaces on the host, and is bound to a the specified port. The socket is configured with the socket options (such as accept timeout) given to this factory.
      Parameters:
        `port` - the port to listen to
      Throws:
        `java.io.IOException` - for networking errors
        `java.lang.InstantiationException` - for construction errors

    - #### createSocket

          java.net.ServerSocket createSocket(int port,
                                           int backlog)
                                             throws java.io.IOException,
                                                    java.lang.InstantiationException

      Returns a server socket which uses all network interfaces on the host, is bound to a the specified port, and uses the specified connection backlog. The socket is configured with the socket options (such as accept timeout) given to this factory.
      Parameters:
        `port` - the port to listen to
        `backlog` - how many connections are queued
      Throws:
        `java.io.IOException` - for networking errors
        `java.lang.InstantiationException` - for construction errors

    - #### createSocket

          java.net.ServerSocket createSocket(int port,
                                           int backlog,
                                           java.net.InetAddress ifAddress)
                                             throws java.io.IOException,
                                                    java.lang.InstantiationException

      Returns a server socket which uses only the specified network interface on the local host, is bound to a the specified port, and uses the specified connection backlog. The socket is configured with the socket options (such as accept timeout) given to this factory.
      Parameters:
        `port` - the port to listen to
        `backlog` - how many connections are queued
        `ifAddress` - the network interface address to use
      Throws:
        `java.io.IOException` - for networking errors
        `java.lang.InstantiationException` - for construction errors

    - #### acceptSocket

          java.net.Socket acceptSocket(java.net.ServerSocket socket)
                                       throws java.io.IOException

      Wrapper function for accept(). This allows us to trap and translate exceptions if necessary.
      Throws:
        `java.io.IOException`

    - #### handshake

          void handshake(java.net.Socket sock)
                         throws java.io.IOException

      Triggers the SSL handshake. This will be a no-op for non-SSL sockets.
      Throws:
        `java.io.IOException`

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.