Module jdk.sctp

Class SctpChannel

java.lang.Object
All Implemented Interfaces:
Closeable, AutoCloseable, Channel, InterruptibleChannel

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

An SCTP channel can only control one SCTP association. An SCTPChannel is created by invoking one of the open methods of this class. A newly-created channel is open but not yet connected, that is, there is no association setup with a remote peer. An attempt to invoke an I/O operation upon an unconnected channel will cause a NotYetConnectedException to be thrown. An association can be setup by connecting the channel using one of its connect methods. Once connected, the channel remains connected until it is closed. Whether or not a channel is connected may be determined by invoking getRemoteAddresses.

SCTP channels support non-blocking connection: A channel may be created and the process of establishing the link to the remote socket may be initiated via the connect method for later completion by the finishConnect method. Whether or not a connection operation is in progress may be determined by invoking the isConnectionPending method.

Socket options are configured using the setOption method. An SCTP channel support 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 channels are safe for use by multiple concurrent threads. They support concurrent reading and writing, though at most one thread may be reading and at most one thread may be writing at any given time. The connect and finishConnect methods are mutually synchronized against each other, and an attempt to initiate a send or receive operation while an invocation of one of these methods is in progress will block until that invocation is complete.

Since:
1.7