Module jdk.sctp

Class SctpMultiChannel

All Implemented Interfaces:
Closeable, AutoCloseable, Channel, InterruptibleChannel

public abstract class SctpMultiChannel extends AbstractSelectableChannel
A selectable channel for message-oriented SCTP sockets.

An SCTP multi channel supports many associations on a single socket. An SctpMultiChannel is created by invoking the open method of this class. A newly-created channel is open but not yet bound. An attempt to invoke the receive method of an unbound channel will cause the NotYetBoundException to be thrown. An attempt to invoke the send method of an unbound channel will cause it to first invoke the bind method. The address(es) that the channel's socket is bound to can be retrieved by calling getAllLocalAddresses.

Messages may be sent and received without explicitly setting up an association with the remote peer. The channel will implicitly setup a new association whenever it sends or receives a message from a remote peer if there is not already an association with that peer. 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.

Socket options are configured using the setOption method. An SctpMultiChannel supports the following options:

Socket options
Option Name Description
SCTP_DISABLE_FRAGMENTS Enables or disables message fragmentation
SCTP_EXPLICIT_COMPLETE Enables or disables explicit message completion
SCTP_FRAGMENT_INTERLEAVE Controls how the presentation of messages occur for the message receiver
SCTP_INIT_MAXSTREAMS The maximum number of streams requested by the local endpoint during association initialization
SCTP_NODELAY Enables or disable a Nagle-like algorithm
SCTP_PRIMARY_ADDR Requests that the local SCTP stack use the given peer address as the association primary
SCTP_SET_PEER_PRIMARY_ADDR Requests that the peer mark the enclosed address as the association primary
SO_SNDBUF The size of the socket send buffer
SO_RCVBUF The size of the socket receive buffer
SO_LINGER Linger on close if data is present (when configured in blocking mode only)
Additional (implementation specific) options may also be supported. The list of options supported is obtained by invoking the supportedOptions method.

SCTP multi channels are safe for use by multiple concurrent threads. They support concurrent sending and receiving, though at most one thread may be sending and at most one thread may be receiving at any given time.