SCTP Protocol Tutorial | SCTP Vs TCP
The Internet is a long-established network. It implements the network layer using the Internet Protocol (IP) and transport layer as TCP. Each node in the network is assigned a unique IP address. Two IP nodes can be reached directly or through intermediate routers.
The IP protocol enables a user message to be routed from its source IP address to its destination IP address within a network end to end. While TCP provides a connection-oriented user message communication.
In this tutorial, we will explain another transport layer protocol named SCTP.
What is SCTP?
The full form of SCTP is Stream Control Transmission Protocol. It is a transport layer protocol that works over the Internet Protocol (IP). Provides a reliable connection-based message delivery mechanism.
In the beginning, there was a requirement for application developers for a protocol that can maintain a session. TCP was the early protocol that does session management between two peers.
Web-based communication uses HTTP on top of TCP/IP. HTTP uses TCP for session management.
The network’s hardware and bandwidth are becoming increasingly faster over time. There were requirements to improve the internet’s suitability for real-time, robust, and high-performance applications too, primarily those in the telecommunications industry.
Then standards for SCTP or Stream Control protocol were standardized in RFC 4960.
The newer transport layer protocol addresses numerous shortcomings of TCP, making it ideal for robust and real-time communications.
SCTP vs TCP, a detailed comparison:
Both protocols operate at the transport layer and make use of the underlying IP protocol. Before you begin, it’s good to familiarise yourself with the SCTP protocol and its purpose. It is necessary to comprehend the fundamental distinctions between these two protocols.
|Age||TCP is a much older protocol, that has existed for decades.||SCTP is a newer protocol.|
|Connection or PATH Monitoring||Do not have protocol messages for connection health monitoring. A user of TCP needs to implement a mechanism for failure detection. E.g HTTP timeout.||The protocol defines messages for link or path health checks. These messages are heartbeat messages. SCTP users immediately get a connection failure indication.|
|Stream-Based (sequence of bytes)||Messages flow over a TCP connection in a stream of bytes. This requires functionality in the user of TCP to put start and end patterns for messages.||Message-based. The sender and receiver need to send and receive a full message. It is like a UDP message flow.|
|Number of Streams||All communication is on one stream. It blocks all bytes in a flow until a corrupted byte is not retransmitted. Not suitable for real-time applications, where time is essential.||Have multiple streams. If one stream blocks, other streams keep carrying bytes. Important for telecom. If a call blocks from one telephone exchange to another. The remaining calls will not block.|
|Network Failure||Having a single network path between source and destination. Because TCP/IP has a single IP address in an endpoint.||It can have multiple network paths from source to destination. Because SCTP/IP has multiple IP addresses in an endpoint.|
|User Base||Due to the older protocol. TCP is used in many places. All HTTP-based communication is based on TCP.||The user base is less in number. Mainly peer or peer applications for telecom or others.|
|Availability||Available on most of the platforms.|| Available on lesser platforms, mainly on |
Linux and Solaris.
What is SCTP Message fromat?
The message is composed of a header and several chunks. The header contains the common information for all chunks, a chuck is for a specific SCTP protocol operation.
SCTP Header :
It has a length of 12 bytes common for all chunks. Have the source and destination port numbers, verification tag, and checksum. The verification tag verifies that a packet is associated with the current association and not with any previous flow.
The checksum is used to ensure that the packet has not been tempered while transmission. CRC-32 is the type. To verify tempering, the sender calculates the value and includes it in the messages, and the receiver calculates it again and compares it to the value included in the message.
What is an SCTP chunk?
Apart from the header, the rest of the message is composed of chunks. A chuck can be a layer control message or a user message.
Control chunks are used to set up or tear down the connection with the peer. A user chunk sends user data to the peer node.
Each chunk has a header and data. The header includes flag, type, and length.
What are the SCTP Chunk types?
- INIT – This chunk is sent by the client to initiate an association. INIT is not permitted to be combined with any other chunk. This is the initial message exchanged to start a four-way handshake.
- INIT-ACK – Acknowledgement message sent by the server in response to an INIT received. If the server accepts a new connection from the client, the INIT ACK should be returned to the source port and source IP of the received INIT. The server includes a list of the local machine’s IP addresses in the ACK message.
- COOKIE ECHO – It is part of a four-way handshake. On successful receiving of INIT-ACK, the client sends a COOKIE ECHO. The chunk has only one parameter, a cookie.
- COOKIE ACK- Acknowledgement send by the server for COOKIE-ECHO.
- SACK- SCTP is a reliable protocol, if a packet is lost, the SCTP layer will correct the error by retransmitting the packet. During retransmission at the SCTP layer, the layer’s user will remain anonymous. A SACK chunk is used to acknowledge the sender of a received packet.
For reliable communication, the sender retains the transmitted packet in the sender queue until it is not acknowledged by the peer. The sender removes the packet from the queue upon receiving a SACK.
HEARTBEAT – Following the establishment of an association, each side begins monitoring the link’s health. Each end transmits heartbeat messages to a peer and waits for a response.
HEARTBEAT ACK – Acknowledgement message for the heartbeat. Upon missing an ack message for a fixed number of a count, the association is marked as inactive and a communication lost indication is sent to the user.
What are the features of SCTP?
SCTP was standardized with many new features that were missing in legacy network protocols. These features enable SCTP, to use for critical applications, e.g telephony. Following is a list of key features of the protocol.
Multi Streaming :
Before this protocol, connection-oriented protocols e.g TCP was using a single stream for transferring data from source to destination. Single stream creates an issue of all communication blocking, in case of single-byte failure, until the failed byte is re-transmitted. This is not suitable for time-critical applications.
Suppose there are ten calls are going on a TCP connection, there is a problem in byte related to a single call. This turns into the blocking of packets for the remaining 9 calls. This eventually may cause the disconnect of the call at all, because of a timeout on a telephone exchange.
SCTP is overcome from a single point of blocking, by providing multiple streams in a connection with the peer. This makes communication faster as well.
Datagram Protocol Style :
Despite that it’s connection-oriented, it can work as a datagram-based protocol. In TCP, a sender and receiver have to put an identifier for the start and end of a message. It creates an additional burden for transport protocol users and before starting communication, both sides should agree on common delimiters. The SCTP protocol provides message-based communication over a connection.
In TCP, an endpoint has a single IP address and a port. If that IP becomes unreachable or disconnects from the network, the TCP connection break down with the peer node. SCTP has the feature of multihoming, where the SCTP endpoint may have multiple IP addresses and a port. So if one IP is unreachable, any other IP can be used for communication with the peer node. During connection set up each side of SCTP, and advertise the IP address list to the peer node. The IP chosen for communication is called the primary IP.
This feature of SCTP provides carrying more than one user data message inside a single SCTP data message.
The protocol provides the heartbeat mechanism for SCTP connection monitoring. Once a connection is set up, each end starts sending a heartbeat to the peer and waits for its acknowledgment on each path within the connection.