Skip to content

Most visited

Recently visited

navigation
Added in API level 1

ServerSocketFactory

public abstract class ServerSocketFactory
extends Object

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


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.

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.

Inherited methods

From class java.lang.Object

Protected constructors

ServerSocketFactory

Added in API level 1
ServerSocketFactory ()

Creates a new ServerSocketFactory instance.

Public methods

createServerSocket

Added in API level 1
ServerSocket createServerSocket (int port)

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

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

createServerSocket

Added in API level 1
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.

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

createServerSocket

Added in API level 1
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.

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

createServerSocket

Added in API level 1
ServerSocket createServerSocket ()

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
ServerSocket the created unbound server socket.
Throws
IOException if an error occurs while creating a new server socket.

getDefault

Added in API level 1
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.

Returns
ServerSocketFactory the system default server socket factory.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.