Messages in pieces
A device never sends a message over a network in one go. It cuts the message into small pieces, called packets, and sends each piece on its own. The device at the other end puts the pieces back together. A short chat message may fit in one packet. A photo becomes a few thousand.
Cutting a message into packets
Everything a device sends is Anything a device stores or sends, such as the letters of a message, a photo, or a call.. Each piece of data travels in a A small piece of data with a label that says where it comes from, where it goes, and which piece it is. Everything on a network travels in packets.. On most networks, one packet holds at most about 1,500 letters of plain text. That limit is the MTU from Cables, light, and radio.
Every packet has a label with three things on it:
| On the label | What it is for |
|---|---|
| From | The answer goes back to this device. |
| To | Every box on the way reads it to know where to pass the packet on. |
| Its number | The receiver puts the pieces back in order, and notices when one is missing. |
On a real network, "from" and "to" are addresses, the subject of the next lesson.
The message as 4 packets:
- No. 1 of 4Laptop → Friend’s phoneMeet me
- No. 2 of 4Laptop → Friend’s phoneat the s
- No. 3 of 4Laptop → Friend’s phonetation a
- No. 4 of 4Laptop → Friend’s phonet five
Received, in the order it came:
- nothing yet
Put back in order by number:
- 1…
- 2…
- 3…
- 4…
Send it, then change the packet size or the loss and send it again. The ways and losses are random, but a run number always gives the same ones.
Different ways, different order
There is often more than one way between two devices. Each box in the middle, like your home router, passes every packet on to the next box. When one way is busy, packets wait there in line. Packets that take a quiet way overtake them.
The packets of one message usually follow the same way, but they do not have to. If a link breaks or gets crowded, later packets may go another way and arrive before earlier ones.
The receiver does not mind the order. It puts each packet in its place by its number. When it has them all, the message is whole again.
Lost packets are sent again
Sometimes a packet never arrives. A box in the middle that is too busy may have no room for one more packet, so it throws the packet away. Radio waves, which Wi-Fi uses, can be disturbed, and a damaged packet is thrown away too. Either way, the packet is lost.
The receiver notices from the numbers. If it has packets 1, 2, 4, and 5, then 3 is missing. It tells the sender which packet is missing, and the sender sends that one packet again. When the gap is filled, the receiver puts the message together.
This happens all the time when you open web pages, send messages, or download files, and you never notice it. Video calls and games work another way. They skip a lost piece, because waiting for it would be worse. Ports and protocols shows how.
A packet sent again can be lost again
The receiver then asks again until the packet arrives, or the sender gives up.
Why cut messages up at all?
Each packet needs a label, and the receiver must put the packets back together. Networks use them anyway, for two reasons.
Packets let devices share a link fairly. A cable carries one thing at a time. With packets, devices take turns, so a short message does not wait behind a long one. So a message from your phone still arrives quickly while someone else at home watches a film.
Packets turn a big loss into a small one. When noise damages one packet, only that packet is sent again, not the whole message.
Smaller packets mean more labels for the same message. Real networks use packets of up to about 1,500 letters. That is small enough to share a link, and large enough to keep the labels a small part of each packet.