Ever Wonder How data is transferred over the internet?

Ever Wonder How data is transferred over the internet?

Have you ever thought about how the server knows that my laptop has made a request and it has to send the response to my device only? And how does my laptop or device knows which application they have to send the response to after getting the data from the server?

In this article, I am going to explain this concept in a very simple and understandable way.

First, let’s understand what the internet is:

The internet is a worldwide computer network that transmits a variety of data and media across interconnected devices. It works by using a packet routing network that follows Internet Protocol (IP) and Transport Control Protocol(TCP).

Don’t worry if you don’t know what IP and TCP are. They are just a set of rules defined by internet society. And we don’t have to understand these protocols in order to know how data is transferred over the internet.

Just know that TCP and IP work together to ensure that data transmission across the internet is consistent and reliable, no matter which device you’re using or where you’re using it.

So basically, how the internet works is that we request the data from the internet server and the server sends back the data to us on our devices.

When data is transferred over the internet, the data gets broken up into bits of same-sized pieces called packets.

Each packet contains the header which explains where the data came from and where it should end up and where it fits in with the rest of the packets.

Packets contain IP addresses.

Now, what is this term IP address?

Well in simple words An IP address, or Internet Protocol address, is a series of numbers that identifies any device on a network. Computers use IP addresses to communicate with each other both over the internet as well as on other networks.

what-is-ip-address.png

Bonus: Want to know your IP address?

Type the following command in your terminal.

curl ifconfig.me -s

We are not going into the details of IP addresses just know what it is.

Our PC or device is connected to the internet through a modem or router. Together, these devices allow you to connect to other networks around the globe.

These Modem and router are connected to our Internet service provider(ISP).

So let’s say for example you type in a web address, known as a URL (Uniform Resource Locator). Each website has its own unique URL that signals to your ISP where you want to go.

your query is pushed to your ISP which connects to several servers which store and send data.

Next, your browser looks up the IP address for the domain name you typed into your search engine through DNS. DNS then translates the text-based domain name you type into the browser into the number-based IP address.

- Example: Google.com becomes 64.233.191.255

Okay, wait I have used a new Term DNS. what is it?

what-is-dns.png

The domain name system (DNS) is responsible for translating domain names into a specific IP address so that the initiating client can load the requested Internet resources.

That’s it. This is what DNS does.

Now let's get back to the track of understanding the process of data transfer.

There are two types of IP addresses :

  • Global or public IP address
  • local or private IP address

public-ip-address-vs-private-ip-address.jpeg

Every router/modem has one global/public IP address and every device connected to it has its own local IP address. So when you request for google.com what the internet sees is that the request is coming from a global/public IP address and not your local/private IP address and it will send data to the public IP address.

So what is the use of a local/private IP address then?

When the response comes how will the router/modem know which device has made the request? That is where the local/private IP address comes into play since each device has its own local/private Ip address so when you make the request the router will know through NAT, okay this particular device has made the request.

Again a new term NAT. What is it?

NAT stands for network access translator It is used by the router to know which device has made the request. NAT maps the local IP address with the global IP address of the router/modem.

More importantly, even if our device receives the internet how does it know which application has made the request? We can be using more than one application at the same time like the web browser or gaming application so, how does it know where to send the data?

This is done by identifying the port number.

A port number is a way to identify a specific process to which an internet or other network message is to be forwarded when it arrives at a server.

  • For example, if you have made an HTTP request the port number will be 80, And if you have made HTTPS the port number will be 443.

So with the help of the port number, your device will identify the application and send data to that application only.

This is a general overview of how data is transferred when typing a web address or requesting anything from the internet. I hope I make this concept simpler for you.

I will be posting more on computer network concepts in the upcoming articles. If you are someone who wants to know more about computer networking stay tuned.

If you have any questions or feedback please do comment and let me know and let’s connect on Twitter, Linkedin, and Instagram to learn and grow together.