Example usage for Java java.net ServerSocket fields, constructors, methods, implement or subclass
The text is from its open source code.
ServerSocket(SocketImpl impl) Creates a server socket with a user-specified SocketImpl . | |
ServerSocket(int port) Creates a server socket, bound to the specified port. | |
ServerSocket() Creates an unbound server socket. | |
ServerSocket(int port, int backlog, InetAddress bindAddr) Create a server with the specified port, listen backlog, and local IP address to bind to. | |
ServerSocket(int port, int backlog) Creates a server socket and binds it to the specified local port number, with the specified backlog. |
Socket | accept() Listens for a connection to be made to this socket and accepts it. |
void | bind(SocketAddress endpoint) Binds the ServerSocket to a specific address (IP address and port number). |
void | bind(SocketAddress endpoint, int backlog) Binds the ServerSocket to a specific address (IP address and port number). |
void | close() Closes this socket. |
ServerSocketChannel | getChannel() Returns the unique java.nio.channels.ServerSocketChannel object associated with this socket, if any. |
InetAddress | getInetAddress() Returns the local address of this server socket. |
int | getLocalPort() Returns the port number on which this socket is listening. |
SocketAddress | getLocalSocketAddress() Returns the address of the endpoint this socket is bound to. |
boolean | getReuseAddress() Tests if SocketOptions#SO_REUSEADDR SO_REUSEADDR is enabled. |
int | hashCode() Returns a hash code value for the object. |
boolean | isBound() Returns the binding state of the ServerSocket. |
boolean | isClosed() Returns the closed state of the ServerSocket. |
void | setReceiveBufferSize(int size) Sets a default proposed value for the SocketOptions#SO_RCVBUF SO_RCVBUF option for sockets accepted from this ServerSocket . |
void | setReuseAddress(boolean on) Enable/disable the SocketOptions#SO_REUSEADDR SO_REUSEADDR socket option. |
void | setSoTimeout(int timeout) Enable/disable SocketOptions#SO_TIMEOUT SO_TIMEOUT with the specified timeout, in milliseconds. |
String | toString() Returns the implementation address and implementation port of this socket as a String . |