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

public Class SctpChannelImpl

extends SctpChannel
Class Inheritance
Imports
com.sun.nio.sctp.Association, .MessageInfo, .NotificationHandler, .SctpChannel, .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 Association
association()

Implements abstract com.sun.nio.sctp.SctpChannel.association.

Returns the association on this channel's socket.

public SctpChannel
bind(SocketAddress local)

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

Binds the channel's socket to a local address.

public SctpChannel
bindAddress(InetAddress address)

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

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

public boolean
connect(SocketAddress remote)

Implements abstract com.sun.nio.sctp.SctpChannel.connect.

Connects this channel's socket.

public boolean
connect(SocketAddress remote, int maxOutStreams, int maxInStreams)

Implements abstract com.sun.nio.sctp.SctpChannel.connect.

Connects this channel's socket.

public boolean
finishConnect()

Implements abstract com.sun.nio.sctp.SctpChannel.finishConnect.

Finishes the process of connecting an SCTP channel.

public Set<SocketAddress>
getAllLocalAddresses()

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

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

public <T> T
getOption(SctpSocketOption<T> name)

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

Returns the value of a socket option.

public Set<SocketAddress>
getRemoteAddresses()

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

Returns all of the remote addresses to which 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 boolean
isConnectionPending()

Implements abstract com.sun.nio.sctp.SctpChannel.isConnectionPending.

Tells whether or not a connection operation is in progress on this channel.

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

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

Receives a message into the given buffer and/or handles a notification.

public int
send(ByteBuffer src, MessageInfo messageInfo)

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

Sends a message via this channel.

public <T> SctpChannel
setOption(SctpSocketOption<T> name, T value)

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

Sets the value of a socket option.

public SctpChannel
shutdown()

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

Shutdown a connection without closing the channel.

public Set<SctpSocketOption<?>>
supportedOptions()

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

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

public SctpChannel
unbindAddress(InetAddress address)

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

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

Inherited from com.sun.nio.sctp.SctpChannel:
openopenvalidOps

Constructor Detail

SctpChannelImplback to summary
public SctpChannelImpl(SelectorProvider provider)

Method Detail

associationback to summary
public Association association()

Implements abstract com.sun.nio.sctp.SctpChannel.association.

Doc from com.sun.nio.sctp.SctpChannel.association.

Returns the association on this channel's socket.

Annotations
@Override
bindback to summary
public SctpChannel bind(SocketAddress local) throws IOException

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

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

Binds the channel's socket to a local address.

This method is used to establish a relationship between the socket and the local addresses. 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.

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

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

Doc from com.sun.nio.sctp.SctpChannel.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 java.nio.channels.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.

Adding addresses to a connected association 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
connectback to summary
public boolean connect(SocketAddress remote) throws IOException

Implements abstract com.sun.nio.sctp.SctpChannel.connect.

Doc from com.sun.nio.sctp.SctpChannel.connect.

Connects this channel's socket.

If this channel is in non-blocking mode then an invocation of this method initiates a non-blocking connection operation. If the connection is established immediately, as can happen with a local connection, then this method returns true. Otherwise this method returns false and the connection operation must later be completed by invoking the finishConnect method.

If this channel is in blocking mode then an invocation of this method will block until the connection is established or an I/O error occurs.

This method may be invoked at any time. If a send or receive operation upon this channel is invoked while an invocation of this method is in progress then that operation will first block until this invocation is complete. If a connection attempt is initiated but fails, that is, if an invocation of this method throws a checked exception, then the channel will be closed.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
connectback to summary
public boolean connect(SocketAddress remote, int maxOutStreams, int maxInStreams) throws IOException

Implements abstract com.sun.nio.sctp.SctpChannel.connect.

Doc from com.sun.nio.sctp.SctpChannel.connect.

Connects this channel's socket.

This is a convience method and is equivalent to evaluating the following expression:

setOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
 .connect(remote);

The maxOutStreams and maxInStreams parameters represent the maximum number of streams that the application wishes to be able to send to and receive from. They are negotiated with the remote peer and may be limited by the operating system.

Annotations
@Override
Exceptions
IOException:
If some other I/O error occurs
finishConnectback to summary
public boolean finishConnect() throws IOException

Implements abstract com.sun.nio.sctp.SctpChannel.finishConnect.

Doc from com.sun.nio.sctp.SctpChannel.finishConnect.

Finishes the process of connecting an SCTP channel.

A non-blocking connection operation is initiated by placing a socket channel in non-blocking mode and then invoking one of its connect methods. Once the connection is established, or the attempt has failed, the channel will become connectable and this method may be invoked to complete the connection sequence. If the connection operation failed then invoking this method will cause an appropriate java.io.IOException to be thrown.

If this channel is already connected then this method will not block and will immediately return true. If this channel is in non-blocking mode then this method will return false if the connection process is not yet complete. If this channel is in blocking mode then this method will block until the connection either completes or fails, and will always either return true or throw a checked exception describing the failure.

This method may be invoked at any time. If a send or receive operation upon this channel is invoked while an invocation of this method is in progress then that operation will first block until this invocation is complete. If a connection attempt fails, that is, if an invocation of this method throws a checked exception, then the channel will be closed.

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.SctpChannel.getAllLocalAddresses.

Doc from com.sun.nio.sctp.SctpChannel.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) throws IOException

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

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

Returns the value of a socket option.

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

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

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

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

If the channel is connected to a remote peer that is bound to multiple addresses then it is these addresses that the 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
isConnectionPendingback to summary
public boolean isConnectionPending()

Implements abstract com.sun.nio.sctp.SctpChannel.isConnectionPending.

Doc from com.sun.nio.sctp.SctpChannel.isConnectionPending.

Tells whether or not a connection operation is in progress on this channel.

Annotations
@Override
receiveback to summary
public <T> MessageInfo receive(ByteBuffer dst, T attachment, NotificationHandler<T> handler) throws IOException

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

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

Receives a message into the given buffer and/or handles a notification.

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. 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 src, MessageInfo messageInfo) throws IOException

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

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

Sends a message via this channel.

If this channel is in non-blocking mode and there is sufficient room in the underlying output buffer, or if this channel is in blocking mode and sufficient room becomes available, 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.

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

The bytes will be written to the stream number that is specified by streamNumber in the given messageInfo.

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> SctpChannel setOption(SctpSocketOption<T> name, T value) throws IOException

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

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

Sets the value of a socket option.

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

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

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

Shutdown a connection without closing the channel.

Sends a shutdown command to the remote peer, effectively preventing any new data from being written to the socket by either peer. Further sends will throw java.nio.channels.ClosedChannelException. The channel remains open to allow the for any data (and notifications) to be received that may have been sent by the peer before it received the shutdown command. If the channel is already shutdown then invoking this method has no effect.

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

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

Doc from com.sun.nio.sctp.SctpChannel.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 SctpChannel unbindAddress(InetAddress address) throws IOException

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

Doc from com.sun.nio.sctp.SctpChannel.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 java.nio.channels.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.

Removing addresses from a connected association 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