I saw a map of undersea internet cables the other day and it’s crazy how many branches there are. It got me wondering - if I’m (based in the UK) playing an online game from someone in Japan for example, how is the route worked out? Does my ISP know that to get to place X, the data has to be routed via cable 1, cable 2 etc. but to get to place Z it needs to go via cable 3, 4?
But surely that can’t really be true either like if I post a selfie on Instagram in London, some guy’s Minecraft server in Minnesota can’t be receiving that and be like “oh not for me - ignore”. It just seems horribly inefficient. But maybe I’m having trouble conceptualising how fast light is? 😅
And based on another answer ITT by FuglyDuck, it would seem that once you’ve resolved a domain you do send it to a central hub that then resolves subnets until it gets to it’s destination, so I can imagine that it does so by physically sending it down “the right cable” as it gets past each layer to get to the final destination via the recepient’s ISP, but imagining it as a giant automated telephone switchboard is all my feeble software brain can comprehend it as and that doesn’t seem right either.
~~Edit: well actually network switches do operate on the data link layer, but also not on the physical one?
I guess what I’m trying to say is: if I’m sending a packet to Japan from the UK - once my packet reaches a hub of a first tier ISP, does it just go down every oceanic cable in every direction, or the one that actually is in the direction of Japan?~~
The answer is that yes - the internet is just a telephone switchboard between what amounts to otherwise isolated networks of ISPs and exchange points physically send light down correct cables with switches:
https://en.m.wikipedia.org/wiki/Internet_exchange_point
Yes, sorry, I did oversimplify to the local network. On your local network everything is always listening, but absolutely your home router/modem in Kansas does NOT excite some wires in Tokyo unless you tell it to lol.
And it sounds like you know way more about the software than I do, but I can say with confidence that when a router starts putting ossilating high/low on a cable, everything on that cable “sees” it. I’m fairly sure that’s why different address blocks have the limits they do; there’s only so many addresses you can have without needing to ossiclate that voltage stupid fast.
You should look into some of the serial examples for raspberry pis/ arduinos, with your software background you’d probably really enjoy it! It’s funny to run into things like the fact that you can have issues like the wire not going back to low sometimes, and the myriad physical issues.
And seriously check out MODBUS. It’s crazy how “simple” it is. With no handshake and a standardized data format, you can trigger all sorts of stuff. That’s the protocol that controls most people industrial things, including GIANT pumps and valves.