Transport Protocols: UDP vs TCP for Streaming
Understand why real-time streaming favors UDP over TCP, how latency, jitter, and packet loss affect live media, and how WebRTC builds reliability on top of UDP.
Transport Protocols: UDP vs TCP for Streaming is a free Real-Time Streaming Systems (WebRTC + Live Data) lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Real-Time Streaming Systems (WebRTC + Live Data) learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Why Transport Matters
Before media can flow, it crosses the network - and the transport protocol shapes latency and quality. The two choices are TCP and UDP.
TCP in a Nutshell
TCP guarantees ordered, reliable delivery: a lost packet is resent before later data arrives. Great for files and pages, where correctness beats speed.
The Head-of-Line Problem
For live media, TCP's reliability backfires. One lost packet stalls everything behind it during the resend - head-of-line blocking - causing freezes.
UDP in a Nutshell
UDP is connectionless and fire-and-forget: no guaranteed order, no retransmits. Packets arrive fast or not at all - ideal for time-sensitive media.
Stale Data Is Useless
In a live call, a frame from two seconds ago is useless. Better to drop a lost frame and move on than wait for a resend - which is why streaming prefers UDP.
Latency, Jitter, Loss
Three metrics define real-time quality: latency (delay), jitter (arrival-timing variation), and packet loss. Keep all three low for a smooth call.
The Jitter Buffer
Since UDP packets arrive unevenly, the receiver uses a small jitter buffer to briefly hold and reorder them before playback - smoothing timing at the cost of tiny delay.
WebRTC Uses UDP
WebRTC sends media over UDP by default, layering RTP for sequencing and timestamps plus SRTP for encryption. It falls back to TCP only when UDP is blocked.
Coping With Loss
Instead of TCP-style retransmits, WebRTC fights loss smartly: FEC sends redundant data, NACK re-requests only critical packets, and concealment hides gaps.
Adapting to the Network
WebRTC constantly measures bandwidth. If the link degrades, congestion control lowers resolution or bitrate to keep the stream alive instead of stalling.
The Right Tool
Pick the right tool: TCP when every byte must arrive in order (downloads, APIs), UDP when timeliness wins (live audio and video) - just as WebRTC does.
Quick Check
Test your understanding of streaming transport.
Recap
Recap: streaming favors UDP because TCP's reliability causes freezes. WebRTC runs RTP/SRTP over UDP with a jitter buffer, FEC, NACK, and congestion control.
Frequently asked questions
Is the “Transport Protocols: UDP vs TCP for Streaming” lesson free?
Yes — the full text of “Transport Protocols: UDP vs TCP for Streaming” is free to read here on the web, and the Real-Time Streaming Systems (WebRTC + Live Data) course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Real-Time Streaming Systems (WebRTC + Live Data) course, upgrade to CoddyKit PRO.
What will I learn in “Transport Protocols: UDP vs TCP for Streaming”?
Understand why real-time streaming favors UDP over TCP, how latency, jitter, and packet loss affect live media, and how WebRTC builds reliability on top of UDP. You practise Real-Time Streaming Systems (WebRTC + Live Data) with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Real-Time Streaming Systems (WebRTC + Live Data)?
No prior experience is required. Real-Time Streaming Systems (WebRTC + Live Data) on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Transport Protocols: UDP vs TCP for Streaming” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Real-Time Streaming Systems (WebRTC + Live Data) lesson?
Yes. Every Real-Time Streaming Systems (WebRTC + Live Data) lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What is Real-Time Communication?
- Overview of WebRTC Technology
- WebRTC Core Components Explained
- Transport Protocols: UDP vs TCP for Streaming