public abstract class FiberServerSocketChannel
extends java.lang.Object
implements java.nio.channels.NetworkChannel
ServerSocketChannel.| Constructor and Description |
|---|
FiberServerSocketChannel() |
| Modifier and Type | Method and Description |
|---|---|
abstract FiberSocketChannel |
accept()
Accepts a connection.
|
abstract FiberServerSocketChannel |
bind(java.net.SocketAddress local)
Binds the channel's socket to a local address and configures the socket to
listen for connections.
|
abstract FiberServerSocketChannel |
bind(java.net.SocketAddress local,
int backlog)
Binds the channel's socket to a local address and configures the socket to
listen for connections.
|
abstract void |
close() |
abstract java.net.SocketAddress |
getLocalAddress() |
abstract <T> T |
getOption(java.net.SocketOption<T> name) |
abstract boolean |
isOpen() |
static FiberServerSocketChannel |
open()
Opens a server-socket channel.
|
static FiberServerSocketChannel |
open(ChannelGroup group)
Opens an server-socket channel.
|
abstract java.lang.Object |
provider()
Returns the IO provider that created this channel.
|
abstract <T> FiberServerSocketChannel |
setOption(java.net.SocketOption<T> name,
T value) |
abstract java.util.Set<java.net.SocketOption<?>> |
supportedOptions() |
public static FiberServerSocketChannel open(ChannelGroup group) throws java.io.IOException, SuspendExecution
If the group parameter is null then the resulting channel is created by the system-wide default provider, and bound to the default group.
group - The group to which the newly constructed channel should be bound, or null for the default groupjava.nio.channels.ShutdownChannelGroupException - If the channel group is shutdownjava.io.IOException - If an I/O error occursSuspendExecutionpublic static FiberServerSocketChannel open() throws java.io.IOException, SuspendExecution
open((AsynchronousChannelGroup) null).java.io.IOException - If an I/O error occursSuspendExecutionpublic abstract FiberSocketChannel accept() throws java.io.IOException, SuspendExecution
This method accepts a
connection made to this channel's socket. The returned result is
the FiberSocketChannel to the new connection.
When a new connection is accepted then the resulting FiberSocketChannel will be bound to the same AsynchronousChannelGroup as this channel. If the group is shutdown and a connection is accepted,
then the connection is closed, and the method throws an IOException with cause ShutdownChannelGroupException.
If a security manager has been installed then it verifies that the
address and port number of the connection's remote endpoint are permitted
by the security manager's checkAccept
method. The permission check is performed with privileges that are restricted
by the calling context of this method. If the permission check fails then
the connection is closed and the operation completes with a SecurityException.
FiberSocketChannel to the new connection.AcceptPendingException - If an accept operation is already in progress on this channelNotYetBoundException - If this channel's socket has not yet been boundjava.nio.channels.ShutdownChannelGroupException - If the channel group has terminatedjava.io.IOExceptionSuspendExecutionpublic abstract boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic abstract void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channeljava.io.IOExceptionpublic abstract FiberServerSocketChannel bind(java.net.SocketAddress local) throws java.io.IOException
An invocation of this method is equivalent to the following:
bind(local, 0);
bind in interface java.nio.channels.NetworkChannellocal - The local address to bind the socket, or null to bind
to an automatically assigned socket addressAlreadyBoundExceptionUnsupportedAddressTypeExceptionjava.lang.SecurityExceptionClosedChannelExceptionjava.io.IOExceptionpublic abstract FiberServerSocketChannel bind(java.net.SocketAddress local, int backlog) throws java.io.IOException
This method is used to establish an association between the socket and a local address. Once an association is established then the socket remains bound until the associated channel is closed.
The backlog parameter is the maximum number of pending
connections on the socket. Its exact semantics are implementation specific.
In particular, an implementation may impose a maximum length or may choose
to ignore the parameter altogther. If the backlog parameter has
the value 0, or a negative value, then an implementation specific
default is used.
local - The local address to bind the socket, or null to bind
to an automatically assigned socket addressbacklog - The maximum number of pending connectionsAlreadyBoundException - If the socket is already boundUnsupportedAddressTypeException - If the type of the given address is not supportedjava.lang.SecurityException - If a security manager has been installed and its checkListen method denies the operationClosedChannelException - If the channel is closedjava.io.IOException - If some other I/O error occurspublic abstract <T> FiberServerSocketChannel setOption(java.net.SocketOption<T> name, T value) throws java.io.IOException
setOption in interface java.nio.channels.NetworkChanneljava.lang.IllegalArgumentExceptionClosedChannelExceptionjava.io.IOExceptionpublic abstract java.net.SocketAddress getLocalAddress()
throws java.io.IOException
getLocalAddress in interface java.nio.channels.NetworkChanneljava.io.IOExceptionpublic abstract <T> T getOption(java.net.SocketOption<T> name)
throws java.io.IOException
getOption in interface java.nio.channels.NetworkChanneljava.io.IOExceptionpublic abstract java.util.Set<java.net.SocketOption<?>> supportedOptions()
supportedOptions in interface java.nio.channels.NetworkChannelpublic abstract java.lang.Object provider()
null.