Module java.base
Package java.net

Class ServerSocket

java.lang.Object
java.net.ServerSocket
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
SSLServerSocket

public class ServerSocket extends Object implements Closeable
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.

The ServerSocket class defines convenience methods to set and get several socket options. This class also defines the setOption and getOption methods to set and query socket options. A ServerSocket supports the following options:

Socket options
Option Name Description
SO_RCVBUF The size of the socket receive buffer
SO_REUSEADDR Re-use address
Additional (implementation specific) options may also be supported.

Since:
1.0
See Also: