|
JavaTM SCTP API DRAFT ea-b09 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.SelectableChannel
java.nio.channels.spi.AbstractSelectableChannel
com.sun.nio.sctp.SctpServerChannel
public abstract class SctpServerChannel
A selectable channel for message-oriented listening SCTP sockets.
An SCTP server channel is created by invoking the
open method of this class. A newly-created SCTP server socket
channel is open but not yet bound. An attempt to invoke the
accept method of an unbound channel will cause the
NotYetBoundException to be thrown. An SCTP server
socket channel can be bound by invoking one of the
bind methods defined by this class.
Socket options are configured using the
setOption method. SCTP server socket
channels support the following options:
and may support additional (implementation specific) options. The list of options supported is obtained by invoking the
Option Name Description SCTP_INIT_MAXSTREAMSThe maximum number of streams requested by the local endpoint during association initialization
options
method.
SCTP server socket channels are safe for use by multiple concurrent threads.
| Constructor Summary | |
|---|---|
protected |
SctpServerChannel(SelectorProvider provider)
Initializes a new instance of this class. |
| Method Summary | ||
|---|---|---|
abstract SctpChannel |
accept()
Accepts an association on this channel's socket. |
|
SctpServerChannel |
bind(SocketAddress local)
Binds the channel's socket to a local address and configures the socket to listen for associations. |
|
abstract SctpServerChannel |
bind(SocketAddress local,
int backlog)
Binds the channel's socket to a local address and configures the socket to listen for associations. |
|
abstract SctpServerChannel |
bindAddress(InetAddress address)
Adds the given address to the bound addresses for the channel's socket. |
|
abstract Set<SocketAddress> |
getAllLocalAddresses()
Returns all of the socket addresses to which this channel's socket is bound. |
|
abstract
|
getOption(SctpSocketOption<T> name)
Returns the value of a socket option. |
|
static SctpServerChannel |
open()
Opens an SCTP server socket channel. |
|
abstract Set<SctpSocketOption<?>> |
options()
Returns a set of the socket options supported by this channel. |
|
abstract
|
setOption(SctpSocketOption<T> name,
T value)
Sets the value of a socket option. |
|
abstract SctpServerChannel |
unbindAddress(InetAddress address)
Removes the given address from the bound addresses for the channel's socket. |
|
int |
validOps()
Returns an operation set identifying this channel's supported operations. |
|
| Methods inherited from class java.nio.channels.spi.AbstractSelectableChannel |
|---|
blockingLock, configureBlocking, implCloseChannel, implCloseSelectableChannel, implConfigureBlocking, isBlocking, isRegistered, keyFor, provider, register |
| Methods inherited from class java.nio.channels.SelectableChannel |
|---|
register |
| Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel |
|---|
begin, close, end, isOpen |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.nio.channels.Channel |
|---|
close, isOpen |
| Constructor Detail |
|---|
protected SctpServerChannel(SelectorProvider provider)
provider - The selector provider for this channel| Method Detail |
|---|
public static SctpServerChannel open()
throws IOException,
UnsupportedOperationException
The new channel's socket is initially unbound; it must be bound
to a specific address via one of its socket's bind
methods before associations can be accepted.
UnsupportedOperationException - If the SCTP protocol is not supported
IOException - If an I/O error occurs
public abstract SctpChannel accept()
throws IOException
If this channel is in non-blocking mode then this method will
immediately return null if there are no pending associations.
Otherwise it will block indefinitely until a new association is
available or an I/O error occurs.
The SCTP socket channel returned by this method, if any, will be in blocking mode regardless of the blocking mode of this channel.
If a security manager has been installed then for each new
association this method verifies that the address and port number of the
assocaitions's remote peer are permitted by the security manager's checkAccept method.
null
if this channel is in non-blocking mode and no association is
available to be accepted
ClosedChannelException - If this channel is closed
AsynchronousCloseException - If another thread closes this channel
while the accept operation is in progress
ClosedByInterruptException - If another thread interrupts the current thread
while the accept operation is in progress, thereby
closing the channel and setting the current thread's
interrupt status
NotYetBoundException - If this channel's socket has not yet been bound
SecurityException - If a security manager has been installed and it does not permit
access to the remote peer of the new association
IOException - If some other I/O error occurs
public final SctpServerChannel bind(SocketAddress local)
throws IOException
This method works as if invoking it were equivalent to evaluating the expression:
bind(local, 0);
local - The local address to bind the socket, or null to
bind the socket to an automatically assigned socket address
ClosedChannelException - If this channel is closed
AlreadyBoundException - If this channel is already bound
UnsupportedAddressTypeException - If the type of the given address is not supported
SecurityException - If a security manager has been installed and its checkListen method
denies the operation
IOException - If some other I/O error occurs
public abstract SctpServerChannel bind(SocketAddress local,
int backlog)
throws IOException
This method is used to establish a relationship between the socket
and the local address. Once a relationship is established then
the socket remains bound until the channel is closed. This relationship
may not necesssarily be with the address local as it may be
removed by unbindAddress, but there will always be
at least one local address bound to the channel's socket once an
invocation of this method successfully completes.
An attempt to bind a socket that is already bound throws
AlreadyBoundException. If the local
parameter has the value null then the socket address is
assigned automatically.
Once the channel's socket has been successfully bound more addresses
may be bound to it using bindAddress, or removed
using unbindAddress.
The backlog parameter is the maximum number of pending associations
on the socket. Its exact semantics are implementation specific. An
implementation may impose an implementation specific maximum length or
may choose to ignore the parameter. 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 the socket to an automatically assigned socket addressbacklog - The maximum number number of pending associations
ClosedChannelException - If this channel is closed
AlreadyBoundException - If this channel is already bound
UnsupportedAddressTypeException - If the type of the given address is not supported
SecurityException - If a security manager has been installed and its checkListen method
denies the operation
IOException - If some other I/O error occurs
public abstract SctpServerChannel bindAddress(InetAddress address)
throws IOException
The channel must be first bound using bind before
invoking this method, otherwise NotYetBoundException is thrown. The bind
method takes a SocketAddress as its argument which typically
contains a port number as well as an address. Addresses subquently bound
using this method are simply addresses as the SCTP port number remains
the same for the lifetime of the channel.
New associations accepted after this method successfully completes will be associated with the given address.
address - The address to add to the bound addresses for the socket
ClosedChannelException - If this channel is closed
NotYetBoundException - If this channel is not yet bound
IllegalArgumentException - If address is null
IOException - If some other I/O error occurs
public abstract SctpServerChannel unbindAddress(InetAddress address)
throws IOException
The channel must be first bound using bind before
invoking this method, otherwise
NotYetBoundException is thrown.
If this method is invoked on a channel that does not have
address as one of its bound addresses, or that has only one
local address bound to it, then this method throws IllegalUnbindException.
The initial address that the channel's socket is bound to using
bind may be removed from the bound addresses for the
channel's socket.
New associations accepted after this method successfully completes will not be associated with the given address.
address - The address to remove from the bound addresses for the socket
ClosedChannelException - If this channel is closed
NotYetBoundException - If this channel is not yet bound
IllegalArgumentException - If address is null
IllegalUnbindException - If the implementation does not support removing addresses from a
listening socket, address is not bound to the channel's
socket, or the channel has only one address bound to it
IOException - If some other I/O error occurs
public abstract Set<SocketAddress> getAllLocalAddresses()
throws IOException
Set if the channel is not
open or the
channel's socket is not bound
IOException - If an I/O error occurs
public abstract <T> T getOption(SctpSocketOption<T> name)
throws IOException
name - The socket option
null may be
a valid value for some socket options.
IllegalArgumentException - If the socket option is not supported by this channel
ClosedChannelException - If this channel is closed
IOException - If an I/O error occursSctpStandardSocketOption
public abstract <T> SctpServerChannel setOption(SctpSocketOption<T> name,
T value)
throws IOException
name - The socket optionvalue - The value of the socket option. A value of null may be
a valid value for some socket options.
IllegalArgumentException - If the socket option is not supported by this channel, or
the value is not a valid value for this socket option
ClosedChannelException - If this channel is closed
IOException - If an I/O error occursSctpStandardSocketOptionpublic abstract Set<SctpSocketOption<?>> options()
This method will continue to return the set of options even after the channel has been closed.
public final int validOps()
SCTP server socket channels only support the accepting of new
associations, so this method returns
SelectionKey.OP_ACCEPT.
validOps in class SelectableChannel
|
JavaTM SCTP API DRAFT ea-b09 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||