Why UDP Is the Wild West of Networking and How TCP Tames It
This article contrasts the fast, connection‑less nature of UDP with the reliable, connection‑oriented TCP, outlines their key characteristics and handshake processes, and then introduces a comprehensive 570‑command Linux cheat‑sheet for administrators and developers.
Preface
In the internet world, UDP behaves like a reckless swordsman, cutting through data streams without a connection, sacrificing reliability for speed; TCP is like a gentleman, establishing a three‑handshake connection, using retransmission and flow control to ensure reliable transmission. Both complement each other: UDP for real‑time video, TCP for web page loading.
The Wild Man: UDP Protocol
Imagine sending a parcel: with UDP you only need the recipient’s address and you ship immediately, without any prior handshake.
Connection‑less
Connection‑less (data is sent as soon as the destination IP is known)
Just a packet carrier
UDP does not generate its own data; it simply forwards the already‑processed payload without adding extra header bytes (only an 8‑byte header).
Only carries data packets (header overhead is minimal, just 8 bytes)
No ordering or reliability
Because UDP sends packets immediately, it cannot guarantee that packets arrive in order or even arrive at all; packet loss may occur.
Does not guarantee packet ordering Does not guarantee reliability (packet loss)
No congestion control
UDP transmits at a constant rate regardless of network conditions, which can lead to packet loss when the network is congested.
Efficiency
The lack of congestion control makes UDP efficient for streaming video or live broadcasts where speed matters more than perfect delivery.
UDP Summary
Connection‑less (send data as soon as the destination IP is known) Only carries data packets (no extra header, only 8 bytes) No packet ordering No reliability (possible packet loss) No congestion control Efficient (the previous five points contribute to efficiency)
Typical applications: live streaming, video, online gaming, and other latency‑sensitive services.
The Gentleman: TCP Protocol
TCP establishes a connection through a three‑handshake process and ends it with a four‑handshake termination, ensuring reliable communication.
Header information
TCP adds several fields to each segment:
Sequence Number
Acknowledgment Number
Window Size (how many bytes the current network can handle)
Flags
Common flag meanings:
URG – urgent packet
ACK – acknowledgment, indicates the segment is valid
PSH – push, tells the receiver to pass data to the application immediately
SYN – synchronize, used to establish a connection
RST – reset, indicates the need to reconnect
FIN – finish, used to close a connection
TCP Three‑Way Handshake
When a client wants to connect to a server, the process is:
TCP three‑way handshake: Client sends SYN, enters SYN‑SEND state. Server replies with SYN+ACK, enters SYN‑RECEIVED state. Client sends ACK, both sides enter ESTABLISHED state.
Why three handshakes?
If the first SYN is lost, the client retransmits; without the final ACK, the server could remain in a half‑open state, wasting resources.
TCP Four‑Way Termination
The connection is closed in four steps:
TCP four‑way termination: Client sends FIN, enters FIN‑WAIT‑1. Server replies ACK, enters CLOSE‑WAIT. Server sends its own FIN after sending remaining data, enters LAST‑ACK. Client replies ACK, enters TIME‑WAIT, then both sides reach CLOSED.
TCP Summary
Reliable and connection‑oriented Slow start and congestion control (adjusts sending rate based on network conditions) Ordered delivery (sequence numbers ensure correct order)
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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
