public class ServerSocketFactory extends Object
Modifier | Constructor and Description |
---|---|
protected |
ServerSocketFactory() |
Modifier and Type | Method and Description |
---|---|
ServerSocket |
createServerSocket(int port)
Creates a server socket on a specified port.
|
ServerSocket |
createServerSocket(int port,
int backlog)
Creates a server socket on a specified port.
|
ServerSocket |
createServerSocket(int port,
int backlog,
InetAddress bindAddr)
Create a server with the specified port, listen backlog, and
local IP address to bind to.
|
static ServerSocketFactory |
getDefault()
Returns the default instance of this class.
|
public static ServerSocketFactory getDefault()
public ServerSocket createServerSocket(int port) throws IOException
0
creates a socket on any free port or if the
tcp.port.range system property is set it creates a socket
within the specified port range.
The maximum queue length for incoming connection indications (a
request to connect) is set to 50
. If a connection
indication arrives when the queue is full, the connection is refused.
port
- the port number, or 0
to use any
free port or if the tcp.port.range property set
to use any available port within the specified port
range.IOException
- if an I/O error occurs when opening the socket.public ServerSocket createServerSocket(int port, int backlog) throws IOException
0
creates a socket on any free port or if the
tcp.port.range system property is set it creates a socket
within the specified port range.
The maximum queue length for incoming connection indications (a
request to connect) is set to the backlog
parameter. If
a connection indication arrives when the queue is full, the
connection is refused.
port
- the port number, or 0
to use any
free port or if the tcp.port.range property set
to use any available port within the specified port
range.backlog
- the maximum length of the queue.IOException
- if an I/O error occurs when opening the socket.public ServerSocket createServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException
port
- the local TCP portbacklog
- the listen backlogbindAddr
- the local InetAddress the server will bind toIOException
- if an I/O error occurs when opening the socket.Copyright © 2016. All rights reserved.