Used only by subclasses.
Create a TCP server socket on a port, using the default authentication context and a specified backlog of connections as well as a particular specified network interface. This constructor is used on multihomed hosts, such as those used for firewalls or as routers, to control through which interface a network service is provided.
If there is a security manager, its checkListen
method is called with the port
argument as its
argument to ensure the operation is allowed. This could result
in a SecurityException.
A port number of 0
creates a socket on any free port.
The backlog
argument is the requested maximum number of
pending connections on the socket. Its exact semantics are implementation
specific. In particular, an implementation may impose a maximum length
or may choose to ignore the parameter altogther. The value provided
should be greater than 0
. If it is less than or equal to
0
, then an implementation specific default will be used.
If address is null, it will default accepting connections on any/all local addresses.
port | the port on which to listen | |
backlog | requested maximum length of the queue of incoming connections. | |
address | the address of the network interface through which connections will be accepted |
IOException | if an I/O error occurs when creating the socket | |
SecurityException | if a security manager exists and its
checkListen method doesn't allow the operation. | |
IllegalArgumentException | if the port parameter is outside the specified range of valid port values, which is between 0 and 65535, inclusive. |
SecurityManager.checkListen
Diagram: Socket