Fundamentals/TCP and UDP/Sending without promises
Chapter · TCP and UDP

Sending without promises

What IP leaves to the application, how an address and a port find the right program, what UDP does with a datagram, and what can happen to it on the way.

  1. 01Why two ways to send4 minIP carries a datagram from one address to another and promises nothing else. TCP and UDP are two different behaviours an application can ask for on top of it, one that repairs loss and keeps order, and one that hands over the datagram and nothing more.
  2. 02Which device, which app4 minAn IP address picks the machine and a 16-bit port picks the program on it. TCP and UDP each keep their own set of port numbers, so the same number on the two is two different doors.
  3. 03UDP: one card, one try4 minA UDP datagram is sent once. It arrives whole or not at all, and nothing in UDP resends it, orders it or removes a duplicate. That makes it the right choice when a newer datagram replaces an older one, and the wrong one when every byte has to arrive.
  4. 04What can happen on the way4 minIP carries a datagram on a best-effort basis, so it can arrive late, twice, out of order or not at all. UDP repairs none of that, and its checksum catches most damage but says nothing about delivery or about who sent the datagram.

Start at 01 and read down — the order is the order things get easier in. Or take the one with your part in it; every article stands on its own, and links back to whatever it needs.