public abstract class ServerSocketChannel extends AbstractSelectableChannel
ServerSocketChannelis a partial abstraction of a selectable, stream-oriented listening socket. Binding and manipulation of socket options can only be done through the associated
ServerSocketobject, returned by calling
socket(). ServerSocketChannels can not be constructed for an already existing server-socket, nor can a
A server-socket channel is open but not bound when created by the
open() method. Calling
accept before bound will cause a
NotYetBoundException. It can be bound by calling the bind method of a
|Modifier||Constructor and Description|
Constructs a new
|Modifier and Type||Method and Description|
Accepts a connection to this server-socket channel.
Creates an open and unbound server-socket channel.
Return the server-socket assigned this channel, which does not declare any public methods that are not declared in
Gets the valid operations of this channel.
blockingLock, configureBlocking, implCloseChannel, implCloseSelectableChannel, implConfigureBlocking, isBlocking, isRegistered, keyFor, provider, register
begin, close, end, isOpen
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static ServerSocketChannel open() throws IOException
This channel is created by calling
of the default
IOException- if an I/O error occurs.
public final int validOps()
public abstract ServerSocket socket()
public abstract SocketChannel accept() throws IOException
This method returns
null when this channel is non-blocking and no
connection is available, otherwise it blocks until a new connection is
available or an I/O error occurs. The socket channel returned by this
method will always be in blocking mode.
This method just executes the same security checks as the
accept() method of the
nullif the channel is non-blocking and no connection is available.
AsynchronousCloseException- if this channel is closed by another thread while this method is in operation.
ClosedByInterruptException- if another thread interrupts the calling thread while this operation is in progress. The interrupt state of the calling thread is set and the channel is closed.
ClosedChannelException- if this channel is closed.
IOException- if another I/O error occurs.
NotYetBoundException- if the socket has not yet been bound.