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
`Socket` `acceptSocket(ServerSocket socket)` Wrapper function for accept().
`ServerSocket` `createSocket(int port)` Returns a server socket which uses all network interfaces on the host, and is bound to a the specified port.
`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.
`ServerSocket` `createSocket(int port, int backlog, 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(Socket sock)` Triggers the SSL handshake.

### Method Detail

#### createSocket

    ServerSocket createSocket(int port)
                              throws IOException,
                                     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:
  `IOException` - for networking errors
  `InstantiationException` - for construction errors

#### createSocket

    ServerSocket createSocket(int port,
                            int backlog)
                              throws IOException,
                                     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:
  `IOException` - for networking errors
  `InstantiationException` - for construction errors

#### createSocket

    ServerSocket createSocket(int port,
                            int backlog,
                            InetAddress ifAddress)
                              throws IOException,
                                     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:
  `IOException` - for networking errors
  `InstantiationException` - for construction errors

#### acceptSocket

    Socket acceptSocket(ServerSocket socket)
                        throws IOException

Wrapper function for accept(). This allows us to trap and translate exceptions if necessary.

Throws:
  `IOException`

#### handshake

    void handshake(Socket sock)
                   throws IOException

Triggers the SSL handshake. This will be a no-op for non-SSL sockets.

Throws:
  `IOException`