Unit 2: The Internet · Transporting packets

Article

What can go wrong with packets

5 min read

You type "see you at five" and send it. The message is cut into four packets. The receiver's phone gets packet 3, then packet 1, then packet 4, and packet 2 never comes. What does your friend read? Without any help, the answer is a mess. This article is about why that can happen.

Four things that can go wrong

Packets travel through many routers and cables, and the Internet makes no promise that every trip goes well. Four problems are common:

ProblemWhat happensA typical cause
Lost packetThe packet never arrives.A router is too busy and throws the packet away, or a link breaks while the packet is on it.
Out-of-order packetsThe packets arrive, but not in the order they were sent.The packets took different routes.
Late packetThe packet arrives, but much later than the others.It took a long or crowded route.
Damaged packetThe packet arrives, but some bits have changed.Electrical noise or a poor connection flipped a 0 to a 1, or the other way round.

None of these is a mistake by the sender or the receiver. They are normal on a network made of millions of shared parts.

Check your understanding

Packet 5 of a message arrives before packet 4. Which problem is this?

Best effort

IP, the protocol that addresses and routes packets, works on a best-effort basis. That means a router does its best to pass each packet on, but it does not promise that the packet will arrive, arrive once, arrive in order, or arrive undamaged.

This sounds bad, but it keeps the Internet simple and fast. Routers do not have to remember every packet or keep track of every conversation. They just forward.

So who deals with the problems? Another protocol, running on the two computers at the ends of the journey. Two such protocols are very common: UDP and TCP. The next two articles explain them. In short, one of them fixes problems and the other does not.

Worked example

The word HELLO is sent as five packets, one letter each:

Packet number12345
LetterHELLO

The packets arrive in this order: 2, 1, 5, 4. Packet 3 never arrives.

HELLO sent as five packets

  1. 1

    Sender → Routers

    Packets 1, 2, 3, 4, 5

  2. 2

    Routers → Receiver✕ lost

    Packet 3 (L)

  3. 3

    Routers → Receiver

    Packet 2 (E)

  4. 4

    Routers → Receiver

    Packet 1 (H)

  5. 5

    Routers → Receiver

    Packet 5 (O)

  6. 6

    Routers → Receiver

    Packet 4 (L)

  7. Sorted by number, the receiver has H, E, a gap, L, O.
Two problems at once. The packets are out of order, and one is missing.
  1. Out of order: the packets arrived as 2, 1, 5, 4. Sorting by packet number gives 1, 2, 4, 5.
  2. Lost packet: packet number 3 is missing.
  3. The receiver can rebuild this: H, E, (gap), L, O.

The text reads HE?LO, which is not the word that was sent. If the receiver just puts down letters as they come, it gets E, H, O, L, which is even worse. Packet numbers fix the order, but only a protocol that can ask for packet 3 again can fix the gap.

Check your understanding

IP works on a "best-effort" basis. What does that mean?

Common mistakes

  • "If a packet is lost, the message is lost." Not necessarily. A protocol on top of IP can notice the gap and ask for the packet again.
  • "Out of order means damaged." No. The packets are fine. They only arrived in a different sequence.
  • "A late packet is the same as a lost packet." A late packet does arrive. For some uses, such as a live call, a very late packet is almost as useless as a lost one, but they are still different problems.
  • "Best effort means the Internet is unreliable, so it is a bad design." It is a deliberate choice that keeps the network simple. Reliability is added at the ends when it is needed.

On the exam

Know the four problems and be able to name each from a short description. Remember that IP does not promise delivery, and that the choice between fixing problems (TCP) and ignoring them for speed (UDP) is made by the protocols at the ends.

Key words

Lost packet: a packet that never reaches its destination.

Out-of-order packets: packets that arrive in a different order from the one they were sent in.

Damaged packet: a packet that arrives with some of its bits changed.

Best effort: trying to deliver every packet, but promising nothing.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this site. All lessons and questions here are written by JrCodex.