Loading learning content...
Understanding protocol characteristics is one thing; applying that knowledge to real applications is another. This page provides actionable guidance—decision trees, application-specific recommendations, and real-world case studies—to help you make confident protocol choices.
We'll move beyond 'it depends' to concrete situations where each protocol excels, fails, or represents a reasonable trade-off. By the end, you'll have a practical framework for answering the question: "Which transport protocol should I use?"
By the end of this page, you will have a practical decision framework for protocol selection, understand specific use cases where each protocol excels, learn from real-world case studies, avoid common mistakes, and understand modern trends including QUIC and HTTP/3.
When choosing a transport protocol, work through these questions in order. Each answer narrows the options:
Question 1: What are your reliability requirements?
Question 2: What are your latency requirements?
Question 3: What's your message semantics?
Question 4: What's your deployment environment?
If you've gone through this framework and still aren't sure, choose TCP. It's the safest default—reliable, well-understood, universally supported. Only move to UDP or SCTP when you have a specific, compelling reason. Many successful applications run on 'good enough' TCP when theoretically a different protocol might be marginally better.
Different application categories have well-established protocol preferences. Here's guidance for common scenarios:
| Application Type | Recommended | Rationale |
|---|---|---|
| Web browsing | TCP (HTTP/1.1, HTTP/2) or QUIC (HTTP/3) | Reliability essential; QUIC improves latency |
| File transfer | TCP (FTP, SFTP, SCP) | Every byte must arrive; streams work well |
| TCP (SMTP, IMAP, POP3) | Messages must be complete; no real-time need | |
| Database queries | TCP (MySQL, PostgreSQL, etc.) | ACID properties require reliable transport |
| DNS queries | UDP (fallback to TCP for large responses) | Short request/response; latency critical |
| DHCP | UDP | Client has no IP yet; broadcast needed |
| NTP time sync | UDP | Timing precision; periodic updates |
| VoIP/Video calls | UDP (RTP/RTCP) | Real-time; late data useless |
| Online gaming | UDP (game-specific protocols) | Low latency; frequent state updates |
| Live streaming | UDP (RTP) or adaptive (HLS/DASH over TCP) | Real-time vs. buffered trade-off |
| IoT sensors | UDP (MQTT-SN, CoAP) or lightweight TCP | Resource constraints; periodic data |
| Telecom signaling | SCTP | Message boundaries; multi-homing; reliability |
| WebRTC data channels | SCTP over DTLS over UDP | Message delivery with browser compat |
Deep Dive: Why Video Streaming is Interesting
Video streaming shows how requirements shape protocol choice:
Live streaming (VoIP, Twitch):
On-demand streaming (Netflix, YouTube):
The same 'application' (video) uses different protocols based on timing requirements.
Protocol choice isn't just transport-level. Consider: Do your developers know UDP socket programming? Does your infrastructure support SCTP? Can your monitoring tools analyze UDP flows? Sometimes TCP is better because your team knows it well, even if UDP would be theoretically faster.
TCP is the right choice in most scenarios. Here's when it's clearly the best option:
TCP in Action: A REST API
Consider a typical REST API:
TCP is perfect:
Using UDP here would require implementing: framing, acknowledgments, retransmission, ordering, duplicate detection—essentially reimplementing TCP, but less well.
TCP is poor for applications sending many small updates where only the latest matters. A stock ticker sending 100 updates/second via TCP will suffer when any update is lost—all subsequent updates wait. Consider UDP or QUIC for such cases.
UDP's simplicity and speed become advantages in specific scenarios:
UDP in Action: A Multiplayer Game
Consider a fast-paced multiplayer game:
UDP is perfect:
Using TCP would cause:
Don't use UDP for reliable transfers and then be 'surprised' that data is missing. If you need reliability over UDP, implement it properly: sequence numbers, acknowledgments, retransmission, timeouts. Half-baked reliability is worse than none.
SCTP's advanced features come with deployment constraints. Use it when features justify complexity:
SCTP in Action: Telecom Signaling
Consider a mobile network's signaling infrastructure:
SCTP is perfect:
Why not TCP? TCP connections would break on interface failure. Multiple TCP connections add overhead. No message boundaries means framing complexity. SYN flood vulnerability in critical infrastructure.
Unless you're in telecom, high-availability infrastructure, or using WebRTC, SCTP is rarely the right choice for new applications. The deployment challenges (NAT, firewalls, limited tooling) usually outweigh the benefits. Consider QUIC instead—it provides streams and low-latency setup over UDP with universal deployment.
QUIC deserves special attention as it changes the protocol selection calculus. It provides TCP's reliability with UDP's flexibility.
| Feature | QUIC Provides | Impact |
|---|---|---|
| Base protocol | UDP | Universal NAT/firewall traversal |
| Reliability | Full TCP-class | Every byte delivered, ordered per stream |
| Streams | Multiple independent | No cross-stream HOL blocking |
| Connection setup | 0-RTT resumption | Faster than TCP for repeat connections |
| Encryption | TLS 1.3 mandatory | Secure by default; encrypted headers |
| Connection migration | Survives IP changes | Mobile clients can switch networks |
| Implementation | User-space | Rapid evolution and experimentation |
When to Consider QUIC:
When QUIC May Not Be Right:
For new applications that would traditionally use TCP, consider QUIC. It's especially compelling for mobile applications, microservices, and anything where connection setup latency or mobile network transitions matter. The major cloud providers and CDNs support HTTP/3 (QUIC) today.
Learning from others' mistakes is efficient. Here are common protocol selection errors:
read() results as complete messages, and getting corrupt data when messages split across packets.Case Study: The TCP Gaming Disaster
A game studio built their multiplayer game using TCP:
Lesson: Match protocol to requirements, not assumptions about what's 'better.'
Don't choose UDP just because 'TCP is slow.' For most applications, TCP is not the bottleneck. Profile your actual application. If protocol overhead is genuinely the problem, then optimize. But often, database queries, business logic, or network latency dwarf protocol costs.
Let's examine how major applications made protocol decisions:
Domain Name System: UDP + TCP Fallback
Why UDP?
Why TCP fallback?
Result: Most queries use UDP (fast). Large responses or secure queries use TCP (reliable). Best of both worlds.
The most sophisticated applications often use multiple protocols for different purposes. Don't think of it as TCP OR UDP—think about what each part of your application needs.
Transport protocols continue to evolve. Here's where things are heading:
The User-Space Transport Trend:
Traditionally, transport protocols were kernel-only. QUIC changed this by implementing a full transport protocol in user-space libraries.
Implications:
Future applications may choose from a menu of transport behaviors rather than picking TCP/UDP/SCTP.
Stay current but don't chase trends prematurely. QUIC/HTTP/3 is ready for production. Most other innovations are still experimental. Stick with proven protocols unless you have a specific, measured problem they solve.
We've covered everything needed to make informed transport protocol decisions. Let's consolidate:
| Situation | Recommended Protocol |
|---|---|
| General reliable delivery | TCP |
| Web applications | HTTP/2 (TCP) or HTTP/3 (QUIC) |
| Real-time audio/video | UDP (RTP) |
| Online gaming | UDP with custom reliability |
| Short query-response | UDP |
| Telecom signaling | SCTP |
| Modern mobile apps | QUIC |
| Browser data channels | SCTP over DTLS (WebRTC) |
| When unsure | TCP |
Congratulations! You've completed the Transport Protocols module. You now understand TCP's reliability mechanisms, UDP's lightweight approach, SCTP's advanced features, and most importantly—when to use each. This knowledge is fundamental to building networked applications that perform well in the real world.