UDP (User Datagram Protocol)
What it is for
IP only delivers a packet to a host. But dozens of programs run on that host -- which one gets it?
★★★ UDP adds exactly one thing: port numbers. Destination port 53 goes to DNS, 443 to QUIC.
★★ Beyond that it does almost nothing; its header is 8 bytes total.
Why have an "unreliable" protocol
★★★ Because reliability costs time: TCP must shake hands three times first, and a loss means waiting out a retransmission timeout.
★★ For one DNS lookup, just asking again beats a round of TCP handshaking; in a video call, a retransmitted frame arrives long after its moment has passed.
★★★ So UDP is not "TCP minus quality" -- it leaves the choice about reliability to the application.
★ Common misconceptions
★★★ "UDP is unreliable, so it is unfit for real work" -- DNS, QUIC (HTTP/3) and video conferencing all run on UDP.
★★★ "UDP is faster than TCP" -- same bandwidth; what it saves is the time spent handshaking and waiting for retransmits.
★★ "UDP has no checksum" -- optional in IPv4 (zero means unchecked), mandatory in IPv6.