to top
Android APIs
public abstract class

ServerSocketFactory

extends Object
java.lang.Object
   ↳ javax.net.ServerSocketFactory
Known Direct Subclasses

Class Overview

This abstract class defines methods to create server sockets. It can be subclassed to create specific server socket types.

Summary

Protected Constructors
ServerSocketFactory()
Creates a new ServerSocketFactory instance.
Public Methods
abstract ServerSocket createServerSocket(int port)
Creates a new server socket which is bound to the given port with a maximum backlog of 50 unaccepted connections.
abstract ServerSocket createServerSocket(int port, int backlog, InetAddress iAddress)
Creates a new server socket which is bound to the given address on the specified port and configures its maximum of queued connections.
abstract ServerSocket createServerSocket(int port, int backlog)
Creates a new server socket which is bound to the given port and configures its maximum of queued connections.
ServerSocket createServerSocket()
Creates a new server socket which is not bound to any local address.
synchronized static ServerSocketFactory getDefault()
Gets the default server socket factory of the system which can be used to create new server sockets without creating a subclass of this factory.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected ServerSocketFactory ()

Added in API level 1

Creates a new ServerSocketFactory instance.

Public Methods

public abstract ServerSocket createServerSocket (int port)

Added in API level 1

Creates a new server socket which is bound to the given port with a maximum backlog of 50 unaccepted connections.

Parameters
port the port on which the created socket has to listen.
Returns
  • the created bound server socket.
Throws
IOException if an error occurs while creating a new server socket.

public abstract ServerSocket createServerSocket (int port, int backlog, InetAddress iAddress)

Added in API level 1

Creates a new server socket which is bound to the given address on the specified port and configures its maximum of queued connections.

Parameters
port the port on which the created socket has to listen.
backlog the maximum number of unaccepted connections. Passing 0 or a negative value yields the default backlog of 50.
iAddress the address of the network interface which is used by the created socket.
Returns
  • the created bound server socket.
Throws
IOException if an error occurs while creating a new server socket.

public abstract ServerSocket createServerSocket (int port, int backlog)

Added in API level 1

Creates a new server socket which is bound to the given port and configures its maximum of queued connections.

Parameters
port the port on which the created socket has to listen.
backlog the maximum number of unaccepted connections. Passing 0 or a negative value yields the default backlog of 50.
Returns
  • the created bound server socket.
Throws
IOException if an error occurs while creating a new server socket.

public ServerSocket createServerSocket ()

Added in API level 1

Creates a new server socket which is not bound to any local address. This method has to be overridden by a subclass otherwise a SocketException is thrown.

Returns
  • the created unbound server socket.
Throws
IOException if an error occurs while creating a new server socket.

public static synchronized ServerSocketFactory getDefault ()

Added in API level 1

Gets the default server socket factory of the system which can be used to create new server sockets without creating a subclass of this factory.

Returns
  • the system default server socket factory.