This class implements server sockets. A server socket waits for
requests to come in over the network. It performs some operation
based on that request, and then possibly returns a result to the requester.
The actual work of the server socket is performed by an instance
of the SocketImpl class. An application can
change the socket factory that creates the socket
implementation to configure itself to create sockets
appropriate to the local firewall.
Create a server with the specified port, listen backlog, and
local IP address to bind to. The bindAddr argument
can be used on a multi-homed host for a ServerSocket that
will only accept connect requests to one of its addresses.
If bindAddr is null, it will default accepting
connections on any/all local addresses.
The port must be between 0 and 65535, inclusive.
port - the local TCP port
backlog - the listen backlog
bindAddr - the local InetAddress the server will bind to
Subclasses of ServerSocket use this method to override accept()
to return their own subclass of socket. So a FooServerSocket
will typically hand this method an empty FooSocket(). On
return from implAccept the FooSocket will be connected to a client.
Enable/disable SO_TIMEOUT with the specified timeout, in
milliseconds. With this option set to a non-zero timeout,
a call to accept() for this ServerSocket
will block for only this amount of time. If the timeout expires,
a java.io.InterruptedIOException is raised, though the
ServerSocket is still valid. The option must be enabled
prior to entering the blocking operation to have effect. The
timeout must be > 0.
A timeout of zero is interpreted as an infinite timeout.