| java.lang.Object | |
| ↳ | java.net.ServerSocket |
Known Direct Subclasses
|
ServerSocket create connections between 'host' and 'client' machines. The ServerSocket listens on a well known port and upon a connection request, instantiates a 'host' sockets, which carries on future communication with the requesting 'client' socket, so that the server socket may continue listening for connection requests. They are passive objects, having no execution thread of their own to listen on.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Construct a ServerSocket, which is not bound to any port.
| |||||||||||
Construct a ServerSocket, bound to the nominated port on the default
localhost.
| |||||||||||
Construct a ServerSocket, bound to the nominated port on the default
localhost.
| |||||||||||
Construct a ServerSocket, bound to the nominated local host/port.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Retrieve the first connection request and answer the 'host' socket that
will conduct further communications with the requesting 'client' socket.
| |||||||||||
Bind the ServerSocket to the nominated local host/port.
| |||||||||||
Bind the ServerSocket to the nominated local host/port.
| |||||||||||
Close this server socket.
| |||||||||||
if ServerSocket is created by a ServerSocketChannel, returns the related
ServerSocketChannel
| |||||||||||
Answer the local IP address for this server socket.
| |||||||||||
Answer the local port for this server socket.
| |||||||||||
Answer the local SocketAddress for this server socket, or null if the
socket is not bound.
| |||||||||||
Answer the socket receive buffer size (SO_RCVBUF).
| |||||||||||
Get the state of the SO_REUSEADDR socket option.
| |||||||||||
Answer the time-out period of this server socket.
| |||||||||||
Return if the server socket is bound to a local address and port.
| |||||||||||
Return if the server socket is closed.
| |||||||||||
sets performance preference for connectionTime,latency and bandwidth
| |||||||||||
Set the socket receive buffer size.
| |||||||||||
Set the SO_REUSEADDR socket option.
| |||||||||||
Set the listen time-out period for this server socket.
| |||||||||||
Set the server socket implementation factory.
| |||||||||||
Returns a string containing a concise, human-readable description of the
server socket.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Invoke the server socket implementation to accept a connection on the
newly created
aSocket. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
Construct a ServerSocket, which is not bound to any port. The default number of pending connections may be backlogged.
| IOException |
|---|
Construct a ServerSocket, bound to the nominated port on the default localhost. The default number of pending connections may be backlogged.
| aport | the port number to listen for connection requests on |
|---|
| IOException |
|---|
Construct a ServerSocket, bound to the nominated port on the default localhost. The number of pending connections that may be backlogged is a specified.
| aport | the port number to listen for connection requests on |
|---|---|
| backlog | the number of pending connection requests, before requests are rejected |
| IOException |
|---|
Construct a ServerSocket, bound to the nominated local host/port. The number of pending connections that may be backlogged is a specified.
| aport | the port number to listen for connection requests on |
|---|---|
| backlog | the number of pending connection requests, before requests are rejected |
| localAddr | the local machine address to bind on |
| IOException |
|---|
Retrieve the first connection request and answer the 'host' socket that will conduct further communications with the requesting 'client' socket.
| IOException | if an error occurs while instantiating the 'host' socket |
|---|
Bind the ServerSocket to the nominated local host/port. The default number of pending connections may be backlogged.
| localAddr | the local machine address and port to bind on |
|---|
| IllegalArgumentException | if the SocketAddress is not supported |
|---|---|
| IOException | if the socket is already bound, or a problem occurs during the bind |
Bind the ServerSocket to the nominated local host/port. The number of pending connections that may be backlogged is a specified.
| localAddr | the local machine address and port to bind on |
|---|---|
| backlog | the number of pending connection requests, before requests are rejected |
| IllegalArgumentException | if the SocketAddress is not supported |
|---|---|
| IOException | if the socket is already bound, or a problem occurs during the bind |
Close this server socket. Any attempt to connect to this socket thereafter will fail.
| IOException |
|---|
if ServerSocket is created by a ServerSocketChannel, returns the related ServerSocketChannel
Answer the local IP address for this server socket. Return null if the socket is not bound. This is useful on multihomed hosts.
Answer the local port for this server socket. Return -1 if the socket is not bound.
Answer the local SocketAddress for this server socket, or null if the socket is not bound. This is useful on multihomed hosts.
Answer the socket receive buffer size (SO_RCVBUF).
| SocketException |
|---|
Get the state of the SO_REUSEADDR socket option.
| SocketException |
|---|
Answer the time-out period of this server socket. This is the time the server will wait listening for connections, before exiting.
| SocketException | thrown if option cannot be retrieved |
|---|---|
| IOException |
Return if the server socket is bound to a local address and port.
Return if the server socket is closed.
sets performance preference for connectionTime,latency and bandwidth
| connectionTime | the importance of connect time |
|---|---|
| latency | the importance of latency |
| bandwidth | the importance of bandwidth |
Set the socket receive buffer size.
| size | the buffer size, in bytes |
|---|
| SocketException | If an error occurs while setting the size or the size is invalid. |
|---|
Set the SO_REUSEADDR socket option.
| reuse | the socket SO_REUSEADDR option setting |
|---|
| SocketException |
|---|
Set the listen time-out period for this server socket.
| timeout | the time to wait for a connection request |
|---|
| SocketException | thrown if an error occurs during setting the option |
|---|
Set the server socket implementation factory. This method may only be invoked with sufficient security and only once during the application lifetime.
| aFactory | the streaming socket factory to be used for further socket instantiations |
|---|
| IOException | thrown if the factory is already set |
|---|
Returns a string containing a concise, human-readable description of the
server socket. The port field is reported a zero, as there
is no connection formed to the server.
Invoke the server socket implementation to accept a connection on the
newly created aSocket.
| aSocket | the concrete socketImpl to accept the connection request on |
|---|
| IOException | thrown if connection cannot be accepted |
|---|