AP® Computer Science Principles · Big Idea 4 · Topic 4.1
Packets: Splitting, Routing, and Reassembly
A message crossing a network gets chopped into small packets, each one addressed and numbered, sent independently, and put back in order on arrival.
Sending a file as one giant unbroken stream is fragile: if anything disrupts that single transmission, you lose the whole thing, and one huge transfer can hog a connection while everyone else waits. So networks break data into packets, small chunks of a few kilobytes each. Each packet can travel its own path across the network, so traffic spreads across many routes instead of jamming one. If a cable or router goes down, packets simply get routed around the damage.
Every packet carries metadata along with its chunk of data: the destination address, the sender's address, and a sequence number saying where that chunk belongs in the original message. Because packets travel independently, they can take different routes and arrive out of order, late, or even duplicated. The sequence number is what makes that fine. The receiving device collects every packet, reads each sequence number, and lays the chunks back down in the correct order before handing the reassembled file to whatever program asked for it.
This is why the network survives damage and congestion that would stop a single-stream connection cold: no one path is required, and no one failure is fatal to the whole message. It also sets up the next idea, what happens when a packet never shows up at all. Protocols build in ways to notice a missing sequence number and ask for that one packet again, rather than resending the entire file.
Key terms
- Packet
- A small chunk of data plus metadata, sent as one unit across a network.
- Metadata
- Information attached to a packet, such as sender, destination, and sequence number, separate from the actual content.
- Sequence number
- A label in a packet showing its position in the original message so it can be reassembled correctly.
- Routing
- The process of directing each packet across the network, possibly along a different path than other packets.
- Reassembly
- Putting received packets back into their original order using sequence numbers to rebuild the full message.
Watch it explained
- How it worksHow does each packet carry metadata that lets the receiver rebuild the original order?
- How it worksWalk me through one image split into packets, routed separately, and then reassembled.
- Worked exampleShow me four packets arriving out of order and being put back into sequence.
- Going furtherWhat happens to the message when one packet never arrives at all?
Check yourself
End of topic.