Represents a server socket: a socket open on the current host that accepts incoming connections from other hosts.

This supports synchronous and asynchronous modes of operations.

The server socket is bound immediately to the specified address (or to every local network interface if not set), but it will only accept incoming connections when you call accept() or acceptAsync().

New server sockets are created with newServerSocket().

By: Stéphane Épardaud

no type hierarchy

no supertypes hierarchy

no subtypes hierarchy

Attributes
localAddressSource Codeshared formal SocketAddress localAddress

Returns the local address this server socket is listening on.

Inherited Attributes
Attributes inherited from: Object
Methods
acceptSource Codeshared formal Socket accept()

Accepts an incoming connection and return its associated Socket. Will block the current thread until there is an incoming connection.

acceptAsyncSource Codeshared formal void acceptAsync(Selector selector, Boolean accept(Socket socket))

Registers an accept listener on the given selector, that will be notified every time there is an incoming connection.

If you wish to stop accepting connections, your listener should return false when invoked.

See also Selector
closeSource Codeshared formal void close()

Closes this server socket.

Inherited Methods
Methods inherited from: Object