APIdia Launch Partner
Top Description Constructors Methods
sun.nio.ch.sctp

public Class SctpMultiChannelImpl

extends SctpMultiChannel
Class Inheritance
Imports
com.sun.nio.sctp.Association, .MessageInfo, .NotificationHandler, .SctpChannel, .SctpMultiChannel, .SctpSocketOption, java.io.IOException, java.net.InetAddress, .SocketAddress, java.nio.ByteBuffer, java.nio.channels.spi.SelectorProvider, java.util.Set

Unimplemented.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Set<Association>
associations()

Implements abstract com.sun.nio.sctp.SctpMultiChannel.associations.

Returns the open associations on this channel's socket.

public SctpMultiChannel
bind(SocketAddress local, int backlog)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.bind.

Binds the channel's socket to a local address and configures the socket to listen for connections.

public SctpMultiChannel
bindAddress(InetAddress address)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.bindAddress.

Adds the given address to the bound addresses for the channel's socket.

public SctpChannel
branch(Association association)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.branch.

Branches off an association.

public Set<SocketAddress>
getAllLocalAddresses()

Implements abstract com.sun.nio.sctp.SctpMultiChannel.getAllLocalAddresses.

Returns all of the socket addresses to which this channel's socket is bound.

public <T> T
getOption(SctpSocketOption<T> name, Association association)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.getOption.

Returns the value of a socket option.

public Set<SocketAddress>
getRemoteAddresses(Association association)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.getRemoteAddresses.

Returns all of the remote addresses to which the given association on this channel's socket is connected.

public void
protected void
implConfigureBlocking(boolean block)

Implements abstract java.nio.channels.spi.AbstractSelectableChannel.implConfigureBlocking.

Adjusts this channel's blocking mode.

public <T> MessageInfo
receive(ByteBuffer buffer, T attachment, NotificationHandler<T> handler)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.receive.

Receives a message and/or handles a notification via this channel.

public int
send(ByteBuffer buffer, MessageInfo messageInfo)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.send.

Sends a message via this channel.

public <T> SctpMultiChannel
setOption(SctpSocketOption<T> name, T value, Association association)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.setOption.

Sets the value of a socket option.

public SctpMultiChannel
shutdown(Association association)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.shutdown.

Shutdown an association without closing the channel.

public Set<SctpSocketOption<?>>
supportedOptions()

Implements abstract com.sun.nio.sctp.SctpMultiChannel.supportedOptions.

Returns a set of the socket options supported by this channel.

public SctpMultiChannel
unbindAddress(InetAddress address)

Implements abstract com.sun.nio.sctp.SctpMultiChannel.unbindAddress.

Removes the given address from the bound addresses for the channel's socket.

Inherited from com.sun.nio.sctp.SctpMultiChannel:
bindopenvalidOps

Constructor Detail

SctpMultiChannelImplback to summary
public SctpMultiChannelImpl(SelectorProvider provider)

Method Detail

associationsback to summary
public Set<Association> associations()

Implements abstract com.sun.nio.sctp.SctpMultiChannel.associations.

Doc from com.sun.nio.sctp.SctpMultiChannel.associations.

Returns the open associations on this channel's socket.

Only associations whose COMM_UP association change event has been received are included in the returned set of associations. Associations for which a COMM_LOST or SHUTDOWN association change event have been receive are removed from the set of associations.

The returned set of associations is a snapshot of the open associations at the time that this method is invoked.

Annotations
@Override
bindback to summary
public SctpMultiChannel bind(SocketAddress local, int backlog) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.bind.

Doc from com.sun.nio.sctp.SctpMultiChannel.bind.

Binds the channel's socket to a local address and configures the socket to listen for connections.

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.

Once the channel's socket has been successfully bound to a specific address, that is not automatically assigned, more addresses may be bound to it using bindAddress, or removed using unbindAddress.

The backlog parameter is the maximum number of pending connections 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.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
bindAddressback to summary
public SctpMultiChannel bindAddress(InetAddress address) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.bindAddress.

Doc from com.sun.nio.sctp.SctpMultiChannel.bindAddress.

Adds the given address to the bound addresses for the channel's socket.

The given address must not be the wildcard address. 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 setup after this method successfully completes will be associated with the given address. Adding addresses to existing associations is optional functionality. If the endpoint supports dynamic address reconfiguration then it may send the appropriate message to the peer to change the peers address lists.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
branchback to summary
public SctpChannel branch(Association association) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.branch.

Doc from com.sun.nio.sctp.SctpMultiChannel.branch.

Branches off an association.

An application can invoke this method to branch off an association into a separate channel. The new bound and connected SctpChannel will be created for the association. The branched off association will no longer be part of this channel.

This is particularly useful when, for instance, the application wishes to have a number of sporadic message senders/receivers remain under the original SCTP multi channel but branch off those associations carrying high volume data traffic into their own separate SCTP channels.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
getAllLocalAddressesback to summary
public Set<SocketAddress> getAllLocalAddresses() throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.getAllLocalAddresses.

Doc from com.sun.nio.sctp.SctpMultiChannel.getAllLocalAddresses.

Returns all of the socket addresses to which this channel's socket is bound.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
getOptionback to summary
public <T> T getOption(SctpSocketOption<T> name, Association association) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.getOption.

Doc from com.sun.nio.sctp.SctpMultiChannel.getOption.

Returns the value of a socket option.

Note that some options are retrieved on the channel's socket, therefore the association parameter is not applicable and will be ignored if given. However, if the option is association specific then the association must be given.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
getRemoteAddressesback to summary
public Set<SocketAddress> getRemoteAddresses(Association association) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.getRemoteAddresses.

Doc from com.sun.nio.sctp.SctpMultiChannel.getRemoteAddresses.

Returns all of the remote addresses to which the given association on this channel's socket is connected.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
implCloseSelectableChannelback to summary
public void implCloseSelectableChannel() throws IOException

Implements abstract java.nio.channels.spi.AbstractSelectableChannel.implCloseSelectableChannel.

Doc from java.nio.channels.spi.AbstractSelectableChannel.implCloseSelectableChannel.

Closes this selectable channel.

This method is invoked by the close method in order to perform the actual work of closing the channel. This method is only invoked if the channel has not yet been closed, and it is never invoked more than once.

An implementation of this method must arrange for any other thread that is blocked in an I/O operation upon this channel to return immediately, either by throwing an exception or by returning normally.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
implConfigureBlockingback to summary
protected void implConfigureBlocking(boolean block) throws IOException

Implements abstract java.nio.channels.spi.AbstractSelectableChannel.implConfigureBlocking.

Doc from java.nio.channels.spi.AbstractSelectableChannel.implConfigureBlocking.

Adjusts this channel's blocking mode.

This method is invoked by the configureBlocking method in order to perform the actual work of changing the blocking mode. This method is only invoked if the new mode is different from the current mode.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
receiveback to summary
public <T> MessageInfo receive(ByteBuffer buffer, T attachment, NotificationHandler<T> handler) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.receive.

Doc from com.sun.nio.sctp.SctpMultiChannel.receive.

Receives a message and/or handles a notification via this channel.

If a message or notification is immediately available, or if this channel is in blocking mode and one eventually becomes available, then the message or notification is returned or handled, respectively. If this channel is in non-blocking mode and a message or notification is not immediately available then this method immediately returns null.

If this method receives a message it is copied into the given byte buffer and an MessageInfo is returned. The message is transferred into the given byte buffer starting at its current position and the buffers position is incremented by the number of bytes read. If there are fewer bytes remaining in the buffer than are required to hold the message, or the underlying input buffer does not contain the complete message, then an invocation of isComplete on the returned MessageInfo will return false, and more invocations of this method will be necessary to completely consume the messgae. Only one message at a time will be partially delivered in any stream. The socket option SCTP_FRAGMENT_INTERLEAVE controls various aspects of what interlacing of messages occurs.

If this method receives a notification then the appropriate method of the given handler, if there is one, is invoked. If the handler returns CONTINUE then this method will try to receive another message/notification, otherwise, if RETURN is returned this method will return null. If an uncaught exception is thrown by the handler it will be propagated up the stack through this method.

This method may be invoked at any time. If another thread has already initiated a receive operation upon this channel, then an invocation of this method will block until the first operation is complete. The given handler is invoked without holding any locks used to enforce the above synchronization policy, that way handlers will not stall other threads from receiving. A handler should not invoke the receive method of this channel, if it does an IllegalReceiveException will be thrown.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
sendback to summary
public int send(ByteBuffer buffer, MessageInfo messageInfo) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.send.

Doc from com.sun.nio.sctp.SctpMultiChannel.send.

Sends a message via this channel.

If this channel is unbound then this method will invoke bind(null, 0) before sending any data.

If there is no association existing between this channel's socket and the intended receiver, identified by the address in the given messageInfo, then one will be automatically setup to the intended receiver. This is considered to be Implicit Association Setup. Upon successful association setup, an association changed notification will be put to the SCTP stack with its event parameter set to COMM_UP . This notification can be received by invoking receive.

If this channel is in blocking mode, there is sufficient room in the underlying output buffer, then the remaining bytes in the given byte buffer are transmitted as a single message. Sending a message is atomic unless explicit message completion SCTP_EXPLICIT_COMPLETE socket option is enabled on this channel's socket.

If this channel is in non-blocking mode, there is sufficient room in the underlying output buffer, and an implicit association setup is required, then the remaining bytes in the given byte buffer are transmitted as a single message, subject to SCTP_EXPLICIT_COMPLETE. If for any reason the message cannot be delivered an association changed notification is put on the SCTP stack with its event parameter set to CANT_START.

The message is transferred from the byte buffer as if by a regular write operation.

This method may be invoked at any time. If another thread has already initiated a send operation upon this channel, then an invocation of this method will block until the first operation is complete.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
setOptionback to summary
public <T> SctpMultiChannel setOption(SctpSocketOption<T> name, T value, Association association) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.setOption.

Doc from com.sun.nio.sctp.SctpMultiChannel.setOption.

Sets the value of a socket option.

Note that some options are retrieved on the channel's socket, therefore the association parameter is not applicable and will be ignored if given. However, if the option is association specific then the association must be given.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
shutdownback to summary
public SctpMultiChannel shutdown(Association association) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.shutdown.

Doc from com.sun.nio.sctp.SctpMultiChannel.shutdown.

Shutdown an association without closing the channel.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
supportedOptionsback to summary
public Set<SctpSocketOption<?>> supportedOptions()

Implements abstract com.sun.nio.sctp.SctpMultiChannel.supportedOptions.

Doc from com.sun.nio.sctp.SctpMultiChannel.supportedOptions.

Returns a set of the socket options supported by this channel.

This method will continue to return the set of options even after the channel has been closed.

Annotations
@Override
unbindAddressback to summary
public SctpMultiChannel unbindAddress(InetAddress address) throws IOException

Implements abstract com.sun.nio.sctp.SctpMultiChannel.unbindAddress.

Doc from com.sun.nio.sctp.SctpMultiChannel.unbindAddress.

Removes the given address from the bound addresses for the channel's socket.

The given address must not be the wildcard address. 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 setup after this method successfully completes will not be associated with the given address. Removing addresses from existing associations is optional functionality. If the endpoint supports dynamic address reconfiguration then it may send the appropriate message to the peer to change the peers address lists.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs