SCTP (Stream Control Transmission Protocol) is a transport-level protocol that provides reliable, connection-oriented data transfer for applications. It is similar to TCP in many ways, but it also has some unique features that make it well-suited for certain types of applications.

Before understanding STCP in detail, lets us have a look on the comparison between SCTP, TCP and UDP. This will give idea why there was need of SCTP and how it has taken the good part of both TCP and SCTP.

ParameterTCPUDPSCTP
ReliabilityReliableNot ReliableReliable
Congestion & Flow controlYesNoYes
Data transmissionSingle Data StreamIt does not provide a stream of data like SCTP or TCPMutiple Data streams
Handshake3-way handshakeIt is connection less so does not do handshaking4-way handshake
Connectionconnection-orientedconnection-lessconnection-oriented
Error Detection & correctionyes, it can detect error and correct itIt cannot error detection or correctionyes, it can detect error and correct it
Header Size20 bytes8 Bytes12 bytes
Message/Byte orientedByteMessageMessage
Preserve Message Boundrydoes not preserve message boundariespreserves message boundariespreserves message boundaries
Comparison of TCP, UDP and SCTP

SCTP Packet Structure

An SCTP packet consists of a common header that is present in all SCTP packets, followed by payload, which can be one or more chunks that contain the actual data being transmitted. Here is a more detailed description of the structure of an SCTP packet:

Common Header

  • Source port: This 16-bit field specifies the port number of the device that is sending the packet.
  • Destination port: This 16-bit field specifies the port number of the device that is receiving the packet.
  • Verification tag: This 32-bit field contains a unique identifier that is used to verify the authenticity of the packet.
  • Checksum: This 32-bit field contains a classic CRC checksum that is used to verify the integrity of the packet.

Chunks

  • Chunk type: This 8-bit field specifies the type of data that is contained in the chunk. There are several different types of chunks that can be included in an SCTP packet, including data chunks, control chunks, and error chunks.
  • Chunk flags: This 8-bit field contains flags that are used to control the behavior of the chunk.
  • Chunk length: This 16-bit field specifies the length of the chunk in bytes.
  • Chunk Data: This field contains the actual data.
SCTP Packet structure
SCTP packet structure

Each chunk may also include additional fields and parameters, depending on the specific type of chunk that is being transmitted. For example, data chunks may include a sequence number and a payload data field, while control chunks may include additional fields for controlling the flow of data.

SCTP Chunk Types

As per the standard, SCTP have many types of chunks. These are explained below

  • DATA chunks: These chunks contain user data that is being transmitted over the network.
  • INIT chunk: This chunk is used to initiate a new association between two devices.
  • INIT-ACK chunk: This chunk is used to acknowledge the receipt of an INIT chunk.
  • SACK chunk: This chunk is used to acknowledge the receipt of data chunks and report the status of previously transmitted data chunks.
  • HEARTBEAT chunk: This chunk is used to check the reachability of a destination and verify that an association is still active.
  • HEARTBEAT-ACK chunk: This chunk is used to acknowledge the receipt of a HEARTBEAT chunk.
  • ABORT chunk: This chunk is used to terminate an association and discard any unacknowledged data.
  • SHUTDOWN chunk: This chunk is used to initiate the graceful shutdown of an association.
  • SHUTDOWN-ACK chunk: This chunk is used to acknowledge the receipt of a SHUTDOWN chunk.
  • ERROR chunk: This chunk is used to report
  • COOKIE-ECHO chunk: This chunk is used to initiate a new association between two devices, and is similar to the INIT chunk. It is used in conjunction with the COOKIE-ACK chunk as part of the four-way handshake process for establishing an association.
  • COOKIE-ACK chunk: This chunk is used to acknowledge the receipt of a COOKIE-ECHO chunk, and is part of the four-way handshake process for establishing an association.
  • SHUTDOWN-COMPLETE chunk: This chunk is used to confirm the completion of the graceful shutdown of an association. It is sent by the device that initiated the shutdown to the other device, and indicates that all data has been transmitted and acknowledged.
  • FORWARD-TSN chunk: This chunk is used to forward the current Transmission Sequence Number (TSN) of a stream to the other device. It is used when a device has received a message but has not yet received all of the messages that precede it.
  • ASCONF chunk: This chunk is used to initiate a modification to an association, such as adding or removing an address.
  • ASCONF-ACK chunk: This chunk is used to acknowledge the receipt of an ASCONF chunk.
  • PKTDROP chunk: This chunk is used to indicate that a packet has been dropped due to congestion or other issues.
  • STREAM-RESET chunk: This chunk is used to reset the transmission and reception of a stream.

SCTP Message Flow

In SCTP (Stream Control Transmission Protocol), messages are transmitted between two devices over a network using a process called “association.” Association is a logical connection between two devices that allows them to transmit and receive data over the network. Let’s discuss it in detail

Association setup

The process of establishing a connection between two devices is called “association setup.” Association setup is necessary before two devices can transmit data over an SCTP association. SCTP uses 4-way handshake for this step.

  1. INIT chunk: The device that wants to initiate an association sends an INIT chunk to the other device. The INIT chunk contains information about the device and its capabilities, such as the maximum number of streams it can support, the maximum size of a message it can transmit, and the types of data it can transmit.
  2. INIT-ACK chunk: The device that receives the INIT chunk sends an INIT-ACK chunk back to the initiating device. The INIT-ACK chunk contains information about the receiving device and its capabilities, as well as a “cookie” that is used to authenticate the association.
  3. COOKIE-ECHO chunk: The initiating device sends a COOKIE-ECHO chunk back to the receiving device, along with the cookie received in the INIT-ACK chunk. This chunk is used to verify the authenticity of the association.
  4. COOKIE-ACK chunk: The receiving device sends a COOKIE-ACK chunk back to the initiating device to confirm the receipt of the COOKIE-ECHO chunk. This completes the association setup process.
SCTP Association Setup
SCTP Association Setup

SCTP Data Transmission

The data is transmitted between the two devices over the network using DATA chunks. DATA chunks contain user data that is being transmitted over the network. Below is a general overview of the process of data transmission in SCTP:

  1. The device that wants to transmit data sends a DATA chunk to the other device. The DATA chunk includes a sequence number that is used to identify the order in which the data was transmitted, and a payload data field that contains the actual data being transmitted.
  2. When a device receives a DATA chunk, it sends a SACK chunk back to the transmitting device to acknowledge the receipt of the data. The SACK chunk includes a list of the sequence numbers of the data chunks that have been received, as well as a list of the sequence numbers of the data chunks that have not yet been received. This allows the transmitting device to identify which data chunks have been successfully transmitted and which ones need to be retransmitted.
  3. If the transmitting device does not receive an acknowledgement within a certain period of time, it may retransmit the DATA chunk. SCTP uses retransmission timers and other mechanisms to ensure the reliable delivery of data.
  4. The process of transmitting and acknowledging data continues until all of the data has been transmitted and acknowledged.

Association shutdown

The process of shutting down an association is called “association shutdown.” Association shutdown allows two devices to terminate an association in a graceful manner, by transmitting any remaining data and acknowledging the receipt of all transmitted data before the association is terminated. The shutdown is down using 3 messages as explained below.

  1. SHUTDOWN chunk: The device that wants to initiate the shutdown of an association sends a SHUTDOWN chunk to the other device. The SHUTDOWN chunk includes the last sequence number of the data that has been transmitted by the initiating device.
  2. SHUTDOWN-ACK chunk: The device that receives the SHUTDOWN chunk sends a SHUTDOWN-ACK chunk back to the initiating device to acknowledge the receipt of the SHUTDOWN chunk.
  3. SHUTDOWN-COMPLETE chunk: The initiating device sends a SHUTDOWN-COMPLETE chunk back to the receiving device to confirm that all data has been transmitted and acknowledged.

Association termination: Once the SHUTDOWN-COMPLETE chunk has been received, the association is terminated, and the devices are no longer able to transmit data to each other.

Ref:

One thought on “SCTP (Stream Control Transmission Protocol)”

Comments are closed.