org.apache.tomcat.util.net

## Class DefaultServerSocketFactory

- java.lang.Object
- - org.apache.tomcat.util.net.DefaultServerSocketFactory

- All Implemented Interfaces:
    ServerSocketFactory

      public class DefaultServerSocketFactory
      extends Object
      implements ServerSocketFactory

  Default server socket factory. Doesn't do much except give us plain old server sockets.
  Author:
    db@eng.sun.com, Harish Prabandham

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultServerSocketFactory(AbstractEndpoint<?> endpoint)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultServerSocketFactory

          public DefaultServerSocketFactory(AbstractEndpoint<?> endpoint)

      Parameters:
        `endpoint` - Unused in this implementation.

  - ### Method Detail

    - #### createSocket

          public ServerSocket createSocket(int port)
                                    throws IOException

      Description copied from interface: `ServerSocketFactory`
      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.
      Specified by:
        `createSocket` in interface `ServerSocketFactory`
      Parameters:
        `port` - the port to listen to
      Throws:
        `IOException` - for networking errors

    - #### createSocket

          public ServerSocket createSocket(int port,
                                  int backlog)
                                    throws IOException

      Description copied from interface: `ServerSocketFactory`
      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.
      Specified by:
        `createSocket` in interface `ServerSocketFactory`
      Parameters:
        `port` - the port to listen to
        `backlog` - how many connections are queued
      Throws:
        `IOException` - for networking errors

    - #### createSocket

          public ServerSocket createSocket(int port,
                                  int backlog,
                                  InetAddress ifAddress)
                                    throws IOException

      Description copied from interface: `ServerSocketFactory`
      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.
      Specified by:
        `createSocket` in interface `ServerSocketFactory`
      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

    - #### acceptSocket

          public Socket acceptSocket(ServerSocket socket)
                              throws IOException

      Description copied from interface: `ServerSocketFactory`
      Wrapper function for accept(). This allows us to trap and translate exceptions if necessary.
      Specified by:
        `acceptSocket` in interface `ServerSocketFactory`
      Throws:
        `IOException`

    - #### handshake

          public void handshake(Socket sock)
                         throws IOException

      Description copied from interface: `ServerSocketFactory`
      Triggers the SSL handshake. This will be a no-op for non-SSL sockets.
      Specified by:
        `handshake` in interface `ServerSocketFactory`
      Throws:
        `IOException`

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