Explaining UDP vs TCP in Simple Terms
This article uses everyday analogies to compare UDP and TCP, outlines their core characteristics, typical use cases, and describes how to add TCP-like reliability features to UDP such as connection establishment, ordering, loss recovery, flow control, and congestion control.
Background
The author shares a real interview question from a technical director at Alibaba that asked to explain the fundamental differences between UDP and TCP and how to add TCP-like features to UDP in a way a non‑technical person could understand.
UDP Characteristics
UDP is likened to a fresh graduate: communication is simple, it trusts others blindly, and it never negotiates. It sends packets without establishing a connection, does not guarantee delivery order or reliability, and works best in low‑resource, low‑latency environments where occasional loss is acceptable, such as real‑time games, IoT, and mobile communications.
TCP Characteristics
TCP is a connection‑oriented, byte‑stream protocol that provides reliable delivery, ordering, flow control, and congestion control. It establishes a connection via a three‑way handshake, maintains state, and adjusts sending rate based on network conditions.
How to Make UDP Behave Like TCP
To give UDP TCP‑like functionality, one can implement:
Connection establishment (e.g., simulate three‑way handshake)
Sequencing and loss recovery using acknowledgments and retransmissions with appropriate timeout calculations (e.g., RTT sampling and adaptive retransmission)
Flow control via sliding windows, embedding window size in acknowledgments
Congestion control using slow start, additive increase/multiplicative decrease, and fast retransmit algorithms
The article includes diagrams of TCP data structures, sliding‑window flow control, and congestion‑control mechanisms.
By presenting these concepts in plain language, the author aims to help interviewers see a solid understanding of both protocols and how to augment UDP with reliability features.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Wukong Talks Architecture
Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
