Routers manage data connections between the internet and computers or connections between computers on a LAN. It makes sense that when, for example, a computer requests music from Pandora, that packets containing music data from Pandora are routed from the internet connection to the computer that requested it.
What if two computers are requesting music from Pandora at the same time? How does the router manage the two incoming data streams? Does it complete one request and move on to the next, similar to a stack, or does it jump between requests, similar to threads, or does it do something totally different?
It’s pretty easy:
A unique connection, or flow, is identified by four numbers:
- The source IP address.
- The source port.
- The destination IP address.
- The destination port.
Thus in the general case it’s trivial to disambiguate between your Pandora stream and your coworker’s.
Packets coming in to a router are generally processed in the order they’re received, unless the router is instructed to handle them differently (e.g. to provide traffic shaping/quality of service). But a full discussion of that is rather too broad for an answer here.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.