Stream Control Transport Protocol (SCTP) in Java

.

Providing support for Stream Control Transport Protocol (SCTP) in Java has been approved as one of the JDK 7 features. The work of defining the API and reference implementation was done through the sctp openjdk project. This work was integrated into JDK 7 Milestone 3 and is available in all future promotions.

What is SCTP ?

The Stream Control Transport Protocol (SCTP) is a reliable, message-oriented, transport protocol existing at an equivalent level with UDP (User Datagram Protocol) and TCP (Transmission Control Protocol). SCTP is session oriented, and an association between the endpoints must be established before any data can be transmitted.

SCTP has direct support for multi-homing, meaning that an endpoint may be represented by more than one address and each address may be used for sending and receiving data, thus providing network redundancy. The connection between two endpoints is referred to as an association between those endpoints. Endpoints can exchange a list of addresses during association setup. One address is designated as the primary address, this is the default address that the peer will use for sending data. A single port number is used across the entire address list at an endpoint for a specific session.

SCTP is message based. I/O operations operate upon messages and message boundaries are preserved. Each association may support multiple independent logical streams. Each stream represents a sequence of messages within a single association and streams are independent of one another, meaning that stream identifiers and sequence numbers are included in the data packet to allow sequencing of messages on a per-stream basis.

Key Features of SCTP

  • Message framing
  • Reliable transport service
  • Session-oriented
  • Ordered and unordered message delivery
  • Multi-Homing
    • Association between exactly two endpoints
    • Each endpoint may be represented by multiple IP addresses
    • Provides failover and redundancy
  • Multi-Streaming
    • Data partitioned into multiple streams
    • Independent sequenced delivery
  • Eliminates head-of-line blocking

Support for SCTP in JDK 7

The Java API is based on the NIO channels framework so that application requiring SCTP can take advantage of non-blocking multiplexed I/O. A new package, com.sun.nio.sctp, was defined to hold the new classes/interfaces. The package name is com.sun.nio.sctp, rather than something like java.nio.channels.sctp.

This distinction means that the API and implementation are fully supported and publicly accessible, but are not part of the Java SE platform. Once there is more experience in the industry with SCTP, then a standard API can be defined.

The main classes within this package are the three new channel types. These new channels can be split into two logical groups.

  1. The first logical group has similar semantics to TCP, SctpChannel and SctpServerChannel. An SctpChannel can control only a single association, that is, sending and receiving data to and from a single endpoint. SctpServerChannel listens and accepts new associations initiated on its socket address.
  2. The second logical group consists of just SctpMultiChannel. Instances of this channel type can control multiple associations, therefore can send and receive data to and from many different endpoints.

The SCTP stack is event driven, and applications can receive notifications of certain SCTP events. These events are most useful with SctpMultiChannel; since it can control multiple associations, you need to track the status of these notifications. For example, AssociationChangeNotification lets you know when new associations are started or terminated. If the association supports dynamic address configuration, then PeerAddressChangeNotification lets you know about IP addresses that have been added or removed from the peer endpoint. MessageInfo allows you to provide ancillary data for the message either being sent or received.





0 comments:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Post a Comment