Cianplan

Level 0: Orientation & prerequisites · L0.3 Networking: TCP/IP, TLS, HTTP/2/3, QUIC

TCP vs UDP

Compare reliability, ordering and latency of TCP and UDP.

12 min · Free

What you take away

  • TCP gives you a connection: ordered bytes, retransmission of anything lost, and flow and congestion control.
  • UDP gives you a datagram: it may arrive, may arrive twice, may arrive out of order — and it never waits.
  • TCP's guarantees cost a handshake round trip up front and head-of-line blocking whenever a packet is lost.
  • Choose UDP when late data is worthless (voice, video, games) or when you want to build your own reliability (QUIC).

How the class is laid out

  1. The problem
  2. The simple version
  3. What the connection costs you
  4. Who uses which
  5. Check your understanding