UDP, SCTP and RTP
Compare and explain the transport protocols UDP (simple datagram), SCTP (reliable multi-stream/multi-homed), and RTP (real-time payload framing) for networking exams.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Two or three sentences: where an engineer uses this.
Transport protocols decide how applications send data over IP networks. UDP is used where low latency and simple datagrams are needed (DNS, DHCP, simple streaming); SCTP is used where reliable, ordered (or partially ordered) delivery with multi-homing and multi-streaming is required (telecom signaling, some carrier-grade services); RTP frames real-time media (audio/video) on top of UDP (or sometimes other transports) and works with RTCP for monitoring and synchronization. Engineers choose among them for trade-offs between latency, reliability, ordering, and network resilience.
Key ideas
Build concepts from first principles. Bold each term when defined.
Define the context: IP provides an unreliable, connectionless packet delivery service (best-effort). Transport protocols add services above IP to meet application needs: reliability, ordering, multiplexing, flow control and congestion control.
UDP (User Datagram Protocol): a simple, connectionless transport. Properties: stateless on the sender/receiver (no handshake), preserves application datagrams (message boundaries), provides multiplexing via ports (16-bit), optional integrity check via a 16-bit checksum (pseudo-header includes IP info), no retransmission, no congestion control built into UDP itself. Exact header fields: Source Port (16 bits), Destination Port (16), Length (16) = UDP header + data (bytes), Checksum (16) = optional for IPv4 (0 means not computed), required for IPv6. UDP header size = 8 bytes. Use when low overhead and low latency matter and the application handles losses (or can tolerate them).
SCTP (Stream Control Transmission Protocol): a message-oriented, connection-oriented transport designed for telephony and similar uses. Key properties: association-oriented (an association ≈ connection), supports multiple streams inside one association to avoid head-of-line blocking between independent message sequences, supports multi-homing (endpoints can have multiple IP addresses for resilience), provides reliable or partially reliable delivery policies at chunk-level, uses chunks as the basic unit inside an SCTP packet, conveys a 4-way handshake for association setup (INIT, INIT-ACK, COOKIE-ECHO, COOKIE-ACK), uses a 32-bit verification tag in the common header for association identification, and uses a 32-bit checksum (CRC-32C) over the packet for corruption protection. SCTP provides congestion control similar to TCP but with different specifics and avoids some TCP issues for its target uses.
- SCTP packet structure to draw: draw a rectangle labeled "SCTP Common Header (12 B)" broken into fields: Source Port (16), Destination Port (16), Verification Tag (32), Checksum (32). Then draw following rectangles labeled "Chunk 1", "Chunk 2", ... each chunk with Chunk Type (8), Chunk Flags (8), Chunk Length (16), Chunk Value (variable). Label typical chunk types: INIT, INIT-ACK, COOKIE-ECHO, COOKIE-ACK, DATA, SACK.
RTP (Real-time Transport Protocol): a protocol to carry real-time multimedia data over a transport (often UDP). RTP itself provides payload type identification, sequence numbers for loss detection, timestamps for playout synchronization, and optional header extensions. It is used with RTCP (RTP Control Protocol) for reporting statistics (packet loss, jitter) and synchronization. RTP is not a transport-level reliability mechanism — it assumes an underlying transport (e.g., UDP) and focuses on timing and media framing.
- RTP base header to draw: 12 bytes divided into fields: Version (2 bits), P (padding) (1), X (extension) (1), CC (4), M (marker) (1), PT (7), Sequence Number (16), Timestamp (32), SSRC (32). Optionally CSRC list follows.
Important differences summarized:
- Connection management: UDP none, SCTP association (4-way), RTP none (relies on session management e.g., SIP).
- Reliability: UDP none, SCTP reliable by default with selective retransmission (configurable partial reliability), RTP none (application-level recovery or FEC used).
- Ordering: UDP preserves datagram boundaries but not ordering; SCTP supports ordered and unordered delivery per-stream; RTP sequence numbers provide ordering detection but not enforced retransmission.
- Use cases: UDP — DNS, DHCP, simple streaming; SCTP — SS7 over IP, signaling; RTP — VoIP, video conferencing.
Formulas
Each formula on its own line, with symbols and units when applicable.
UDP header size = 8 bytes — UDP header fixed length; bytes.
SCTP common header size = 12 bytes — (2 bytes src port + 2 dst port + 4 bytes verification tag + 4 bytes checksum); bytes.
RTP base header size = 12 bytes — when CC = 0 and no extension; bytes.
UDP checksum = 1's complement of (1's complement sum of 16-bit words of pseudo-header + UDP header + UDP data) — pseudo-header (IPv4): Source IP (32), Destination IP (32), zero (8), Protocol (8), UDP length (16). Units: 16-bit words; applies when checksum computed.
RTP timestamp increment Δ = sample_rate * frame_duration — sample_rate in Hz (samples/s), frame_duration in seconds; timestamp is an integer count in RTP clock units.
Interarrival jitter (RFC 3550) update: J = J + (|D| - J)/16 where D = (R_i - S_i) - (R_{i-1} - S_{i-1})` — R_k are arrival times in seconds (or timestamp units), S_k are RTP timestamps in same clock units scaled to seconds if needed; J is smoothed mean deviation; units: seconds (or RTP clock units).
SCTP checksum = CRC-32C over the SCTP packet — 32-bit CRC; applies to SCTP packets.
Notes: define symbols in context of examples below.
Worked examples
Two examples of exam standard: SCTP handshake trace and RTP timestamp/jitter numeric.
Example 1 — SCTP association setup (protocol trace): Problem: Show the messages and key fields for establishing an SCTP association between Host A (port 2905) and Host B (port 2905). Assume Host A has IP1, Host B has IP2. Show sequence and explain purpose.
Answer (step-by-step model answer):
- Host A -> Host B: SCTP packet containing an INIT chunk. Draw packet: Common Header (Source Port 2905, Dest Port 2905, Verification Tag = 0x00000000 for INIT), Chunk: INIT, containing Initiate Tag (32-bit), Advertised Receiver Window (a_rwnd), number of outbound streams, number of inbound streams, initial TSN (Transmission Sequence Number). Purpose: starts association and conveys receiver resources.
- Host B -> Host A: SCTP packet containing INIT-ACK chunk. Common Header: Verification Tag set to Initiate Tag from A; Chunk: INIT-ACK includes B's Initiate Tag, a_rwnd, stream counts, initial TSN, plus a Cookie parameter. Purpose: offer parameters and send a stateless cookie to avoid resource allocation on B.
- Host A -> Host B: SCTP packet containing COOKIE-ECHO chunk carrying the cookie back. Common Header: Verification Tag from B. Purpose: proves A received INIT-ACK and allows B to re-create state.
- Host B -> Host A: SCTP packet containing COOKIE-ACK chunk. Association is now established. After this, data (DATA chunks) can be exchanged; SCTP uses TSNs for reliability and SACK chunks for selective acknowledgements.
Full-marks answer should explain multi-homing (if multiple IPs exist, INIT/INIT-ACK list addresses), and that the cookie prevents SYN-flood-like resource exhaustion by keeping B stateless until COOKIE-ECHO.
Example 2 — RTP timestamps and jitter numeric Problem: An RTP audio stream uses an 8000 Hz clock and 20 ms audio frames. Packets are numbered sequentially and a receiver measures arrival times; compute RTP timestamp increments and compute interarrival jitter J after receiving 4 packets with given arrival times.
Given: sample_rate = 8000 Hz. frame_duration = 20 ms = 0.02 s. Sequence numbers start at 1000. RTP timestamp for packet 1 is 16000 (example start). Arrival times R_i in seconds: packet1 R1 = 0.100 s, packet2 R2 = 0.125 s, packet3 R3 = 0.145 s, packet4 R4 = 0.170 s. RTP timestamps S_i: compute with Δ = 8000*0.02 = 160 per packet.
Steps:
- Compute timestamps: S1 = 16000 (given). S2 = 16000 + 160 = 16160. S3 = 16160 + 160 = 16320. S4 = 16320 + 160 = 16480.
- Convert S_i to seconds for D calculation (use clock of 8000 Hz => 1 timestamp unit = 1/8000 s): S1_s = 16000/8000 = 2.0 s, S2_s = 16160/8000 = 2.02 s, S3_s = 2.04 s, S4_s = 2.06 s. (Note: RTP timestamps are absolute media clock; relative offsets matter.)
- Compute D values: D2 = (R2 - S2_s) - (R1 - S1_s) = (0.125 - 2.02) - (0.100 - 2.0) = (-1.895) - (-1.900) = 0.005 s. D3 = (0.145 - 2.04) - (0.125 - 2.02) = (-1.895) - (-1.895) = 0.000 s. D4 = (0.170 - 2.06) - (0.145 - 2.04) = (-1.89) - (-1.895) = 0.005 s.
- Initialize J = 0. Update per RFC 3550: J = J + (|D| - J)/16.
- After packet2: |D2| = 0.005 => J = 0 + (0.005 - 0)/16 = 0.0003125 s.
- After packet3: |D3| = 0 => J = 0.0003125 + (0 - 0.0003125)/16 = 0.0003125 - 0.00001953125 = 0.00029296875 s.
- After packet4: |D4| = 0.005 => J = 0.00029296875 + (0.005 - 0.00029296875)/16 = 0.00029296875 + 0.000294189453125 = 0.000587158203125 s.
- Final jitter J ≈ 0.0005872 s (≈ 0.587 ms). Bold final numeric answer: 0.0005872 s (0.587 ms).
Notes: full marks require showing timestamp increment calculation, converting timestamp units to seconds, and applying the RFC jitter update formula step-by-step.
Common mistakes
- Believing SCTP is identical to TCP; SCTP supports multi-streaming and multi-homing and uses chunks and a different handshake.
- Omitting the pseudo-header when describing UDP checksum computation (the pseudo-header includes IP addresses and protocol number).
- For RTP, treating sequence numbers as timestamps: sequence numbers detect loss and order, timestamps capture media sampling time and clock; they are different fields with different semantics.
- Wrong header sizes: remember UDP = 8 B, RTP base = 12 B, SCTP common header = 12 B (plus variable chunks).
For your exam
Kinds of questions and what full-marks answers include:
- Definitions and comparisons: define UDP, SCTP, RTP; list properties and use-cases; concise table comparing connection/state, reliability, ordering and typical uses.
- Diagram and explain header formats: draw UDP header with 4 fields; draw RTP base header with fields and bit widths; draw SCTP common header plus chunk layout and label fields.
- Derivations/explanations: show how UDP checksum is computed (pseudo-header, 1's complement sum), explain SCTP handshake sequence and why cookie is used, derive RTP timestamp increment for a given sampling rate/frame size.
- Numericals: compute RTP timestamp increments, compute interarrival jitter per RFC 3550, compute total packet size given payload and header sizes (remember to add UDP or SCTP + IP + link-layer overhead if asked).
- Short notes: explain multi-homing in SCTP, partial reliability feature (PR-SCTP), role of RTCP alongside RTP.
What a full-marks answer includes: clear definitions of bolded terms, correct header sizes and field names, properly labeled diagram descriptions, step-by-step calculations showing units, and brief discussion of trade-offs / use-cases.
Quick check
- What is the UDP header size in bytes?
- Which RTP field is used to detect packet loss and ordering?
- Name two features of SCTP that TCP does not provide.
Answers: 1) 8 bytes. 2) Sequence Number (16-bit). 3) Multi-streaming (multiple independent streams within an association) and multi-homing (an endpoint can have multiple IP addresses for resilience).
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?