it’s called packet switching. every connection you make is not a continuous stream of data, it’s split into small packets of data. each packet has the address of where it’s going, and a little bit of data. they are all sent out into the internet and make their own way to where they’re going.
so the packet is first sent from your phone to your wifi point. your WiFi looks at the address and decides where to send it, usually you’re talking to the internet so it sends it down the cable to your ISP / internet provider. your wi-fi point could send it to another device in your network if that’s where it’s going, like your tv if you’re sharing your phone screen to it, but we’ll assume it needs to go to your isp.
once it’s down the cable to the isp, your isp looks at the packet address and chooses another cable to send it down. this gets your packet going in the right direction to its destination.
now your isp is receiving packets from a lot of houses all at once. so if a few packets need to go down the same cable, it’ll send your packet down then one from your neighbour, then one from someone across town. all the packets are mixed up together like this.
then it’s received on the other side and the same process happens again, whoever received it looks at it, chooses a cable that gets it closer and sends it down there.
your packet bounces around like this from link to link, at every point whoever receives it looks at the address and gets it another step closer to its destination until finally it reaches where it needs to go.
then the server that receives it does whatever it needs to do, like maybe start streaming a video to your phone. so it knows how to reach your phone because the data was in that packet. so now it starts sending packets to your phone. each packet contains just a little bit of the movie. each one is sent down the various cables individually in exactly the same way that your packet went, each one is routed individually at each step and mixed in with packets from other people. in theory each packet could take different routes to reach your phone. your phone eventually receives these packets, puts them back in order and starts showing you the video.
these big undersea cables can carry far more packets per second than your video needs, so the cable isn’t carrying just your video. the internet providers can just stuff packets down these cables from all kinds of different people, all mixed up.
but because each packet has its destination marked clearly at the front of each, each step routes it closer to its destination, so your data doesn’t get lost or confused with someone else’s.
what happens if there are too many packets being sent down one cable and it’s too full? well there might be a very small queue, if that’s full the router might try to find an alternative route, like: this route is ideal, but if it’s full this one will also work. or if it can’t find a route to use, it’ll just drop the packet.
if your packet gets dropped your phone and the server know how to detect that and your phone will send the packet again. basically, every time the server receives a packet from your phone, it sends back an acknowledgement, called an ACK. if your phone doesn’t receive the ACK after a certain amount of time, it’ll send the packet again.
Latest Answers