Best afterPacket switching
Packets take different routes
A message does not cross the internet in one piece. It is chopped into numbered packets, each of which finds its own way to the destination — so they arrive out of order and have to be put back together by sequence number. Switch the abstraction on and watch three packets (the numbered dots) fan out across the network and reassemble at D.
Send one message as three packets across the network and reassemble it correctly at the destination.
—Click a line, drag the slider, or use the ← → keys.
What you are looking at
One message, three packets (0, 1, 2), each handed a different route from A to D. Packet 0 takes the long way, so it is sent first but arrives last — the packets reach D in the order 1, 2, 0.
- Buggy — the receiver keeps the packets in arrival order, so the message reassembles as
[1, 2, 0]: scrambled. Out-of-order delivery has corrupted it. - Procedural — the receiver sorts by sequence number (
sorted(arrived)), restoring[0, 1, 2]. Split, route independently, reassemble in order — that is exactly what "packet switching" means, and why the network can route around trouble without losing the message.
The packets' movements are real execution output; the little network is a hand-built model (marked model: author-asserted) — see how GlassBox stays honest.