Java java.net ServerSocket fields, constructors, methods, implement or subclass

Example usage for Java java.net ServerSocket fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.net ServerSocket.

The text is from its open source code.

Subclass

java.net.ServerSocket has subclasses.
Click this link to see all its subclasses.

Constructor

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.

Method

Socketaccept()
Listens for a connection to be made to this socket and accepts it.
voidbind(SocketAddress endpoint)
Binds the ServerSocket to a specific address (IP address and port number).
voidbind(SocketAddress endpoint, int backlog)
Binds the ServerSocket to a specific address (IP address and port number).
voidclose()
Closes this socket.
ServerSocketChannelgetChannel()
Returns the unique java.nio.channels.ServerSocketChannel object associated with this socket, if any.
InetAddressgetInetAddress()
Returns the local address of this server socket.
intgetLocalPort()
Returns the port number on which this socket is listening.
SocketAddressgetLocalSocketAddress()
Returns the address of the endpoint this socket is bound to.
booleangetReuseAddress()
Tests if SocketOptions#SO_REUSEADDR SO_REUSEADDR is enabled.
inthashCode()
Returns a hash code value for the object.
booleanisBound()
Returns the binding state of the ServerSocket.
booleanisClosed()
Returns the closed state of the ServerSocket.
voidsetReceiveBufferSize(int size)
Sets a default proposed value for the SocketOptions#SO_RCVBUF SO_RCVBUF option for sockets accepted from this ServerSocket .
voidsetReuseAddress(boolean on)
Enable/disable the SocketOptions#SO_REUSEADDR SO_REUSEADDR socket option.
voidsetSoTimeout(int timeout)
Enable/disable SocketOptions#SO_TIMEOUT SO_TIMEOUT with the specified timeout, in milliseconds.
StringtoString()
Returns the implementation address and implementation port of this socket as a String .