javax.net

Class ServerSocketFactory

  1. java.lang.Object
  2. extended byjavax.net.ServerSocketFactory
Direct known subclasses:
SSLServerSocketFactory

  1. public abstract class ServerSocketFactory
  2. extends Object
This class creates server sockets. It may be subclassed by other factories, which create particular types of server sockets. This provides a general framework for the addition of public socket-level functionality. It is the server side analogue of a socket factory, and similarly provides a way to capture a variety of policies related to the sockets being constructed.

Like socket factories, server Socket factory instances have methods used to create sockets. There is also an environment specific default server socket factory; frameworks will often use their own customized factory.

Since:
1.4
See Also:
SocketFactory

Constructor Summary

Modifier Constructor and Description
  1. protected
ServerSocketFactory()
Creates a server socket factory.

Method Summary

Modifier and Type Method and Description
  1. ServerSocket
createServerSocket()
Returns an unbound server socket.
  1. abstract
  2. ServerSocket
createServerSocket(int port)
Returns a server socket bound to the specified port.
  1. abstract
  2. ServerSocket
createServerSocket(int port,int backlog)
Returns a server socket bound to the specified port, and uses the specified connection backlog.
  1. abstract
  2. ServerSocket
createServerSocket(int port,int backlog,InetAddress ifAddress)
Returns a server socket bound to the specified port, with a specified listen backlog and local IP.
  1. static
  2. ServerSocketFactory
getDefault()
Returns a copy of the environment's default socket factory.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ServerSocketFactory

  1. protected ServerSocketFactory()
Creates a server socket factory.

Method Detail

getDefault

  1. public static ServerSocketFactory getDefault( )
Returns a copy of the environment's default socket factory.
Returns:
the ServerSocketFactory

createServerSocket

  1. public ServerSocket createServerSocket( )
  2. throws IOException
Returns an unbound server socket. The socket is configured with the socket options (such as accept timeout) given to this factory.
Returns:
the unbound socket
Throws:
IOException - if the socket cannot be created
See Also:

createServerSocket

  1. public abstract ServerSocket createServerSocket( int port)
  2. throws IOException
Returns a server socket bound to 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
Returns:
the ServerSocket
Throws:
IOException - for networking errors
See Also:

createServerSocket

  1. public abstract ServerSocket createServerSocket( int port,
  2. int backlog)
  3. throws IOException
Returns a server socket bound to 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
Returns:
the ServerSocket
Throws:
IOException - for networking errors
See Also:

createServerSocket

  1. public abstract ServerSocket createServerSocket( int port,
  2. int backlog,
  3. InetAddress ifAddress)
  4. throws IOException
Returns a server socket bound to the specified port, with a specified listen backlog and local IP. The ifAddress argument can be used on a multi-homed host for a ServerSocket that will only accept connect requests to one of its addresses. If ifAddress is null, it will accept connections on all local addresses. 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
Returns:
the ServerSocket
Throws:
IOException - for networking errors
See Also: