What happens when you type google.com in your browser and press Enter

What happens when you type google.com in your browser and press Enter

Let's back up a bit and first ask why. Why would you enter google.com in your browser? Well, I dare not answer for you, but I do it (which also seems like the most obvious reason) because Google has much information on diverse topics, people, places etc, and I would like a piece of that once in a while. Also, it turns out that I'm not the only wiseass, a bunch of people would also love to get a piece of that information too. Okay great, we now have a problem, Google has a whole bunch of information and we would like to be informed (by Google), so Google has to figure out how to deliver this information to us. I reckon two solutions, this article discusses the second, so let's take a peek at the first. Google could:

  • build one or more libraries,
  • have this information printed on pages of books,
  • stack up these books on shelves, and
  • finally, make the address of this library known to the public so they can visit it whenever they need information.

Three decades ago, this solution would have made more sense, but now we have computers, which make our lives easier. Why do I have to travel hundreds of kilometres at below 100km/hr just to find a library, when the signal from my computer can travel at above 1,000,000,000 km/hr, that's a huge number, right? Okay, we now have a baseline, computers would do a much better job, but how?

The Internet

According to Merriam-webster, the internet is an electronic communications network that connects computer networks and organizational computer facilities around the world. Through the internet, computers can communicate and share information all over the world by abiding by a common set of rules known as the Internet Protocol (IP). Computers in a network, possess a unique identifier known as an IP address. An IP address can be of two types;

  • IPv4, are 32-bit integers that are expressed using the hexadecimal notation, eg 192.0.2.146. Any of the groups delimited with the period (.) can range from 0 -> 255. Due to the rise in technology, the number of unique devices that are connected to the internet has surpassed the total number of possible unique IPv4 addresses (~4.3 billion), which led to the introduction of another version of the IP address.
  • IPv6, are 128-bit integers that are expressed using the hexadecimal notation, eg 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Any of the groups delimited with the column (:) can range from 0 -> FFFF. Let's just say we won't be running out of unique addresses any time soon.

With the use of an IP address, computer A can communicate with another computer B, by appending the IP address of B to the data being sent. Based on this model computer A would send the required data but has no way to confirm that it reached computer B, this problem was solved using the Transmission Control Protocol (TCP). The TCP is built on top of the Internet Protocol, it is a set of rules that ensure the reliable transmission of data from one computer to another. Using the TCP, when a computer wants to communicate with another one on a network, it initiates what is known as a three-way handshake, when this has been completed then the two computers are ready to communicate over the network. Using the TCP, for every piece of data (also known as data packets) sent from one computer A to another computer B, an acknowledgement is sent from B to A, this ensures that A would know which data packets were lost and would have to resend them.

Okay, back to our discussion on Google, so instead of setting up libraries, they decide to set up a powerful computer (known as a server) and give out the IP address of this server to the public. Things are much better now, I don't need to travel for hours just to get some information from a library, I can just provide the IP address provided by Google to my computer (known as a client) and let it do all the work.

Wait a minute, doesn't this mean that I would have to remember the IP address of google, it doesn't seem like much but imagine Google has 5 servers, that's five different IP addresses, and you also want to get information from Wikipedia, chat on Facebook, shop on Amazon, that's a lot of IP addresses to keep track of. To solve this problem, the Domain Name System (DNS), was introduced.

Domain Name System

No alt text provided for this image

According to Wikipedia, the Domain Name System (DNS) is the hierarchical and decentralized naming system used to identify computers reachable through the Internet or other Internet Protocol (IP) networks. What this means, is that you don't have to remember the IP addresses of google or any other organization, just provide the domain name of the desired server to the domain name server and it will provide you with the IP address of the server.

HTTP/HTTPS

So far we have discussed Network level protocols, we need to discuss application-level protocol, and how your browser understands the data it fetches from the server. The Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML (Hyper Text Markup Language). HTML is the data format that web browsers and web servers use to communicate. HTTPS is known as HTTP over SSL/TLS. When clients and servers communicate using HTTP, the data is shared in clear text, which means that a third party who has access to the data in transit can be able to see what is being sent. HTTPS solves this problem by ensuring that the data is encrypted before being transferred between the client and the server.

Static And Dynamic Websites

A static web page is a web page that is delivered to the user's web browser exactly as stored. So HTML documents are created and stored on the server, when a client needs any of them, they establish a connection with the webserver, which transfers the required document to them. This means that similar requests generate similar responses for every client. For a simple website, this is enough, but for complex/dynamic websites, there's a need to do some processing on the server and provide unique reponses for every request. In this scenario, we make use of a different kind of software known as an application server.

In a dynamic website, the server makes use of an application server to process a request and generate a reponse for each client. Processing a request might involve;

  • querying information from a database
  • persisting information on the database,
  • requesting to another web server, etc.

After this processing, the server sends a response back to the client.

Answer to the Question...

What happens when you type google.com in your browser and press enter:

  1. the browser sends a request to a DNS server, requesting for the IP address of 'google.com'.
  2. When the browser receives the IP address of google.com, it tries to create a TCP connection with the server which involves a 3-way handshake.
  3. When the connection is created, the browser send a HTTP GET request to the web.
  4. When the server gets the requests, it might decide to redirect the request to a HTTPS connection
  5. Its now time to process the request by the server, the server processes the request and generates a response for the client
  6. When the browser recieves the response it renders the content as a webpage for the the user.

Franklin Chinedu

Software Engineer (JavaScript || React Js || Typecript || Next Js || Express Js || Mongo Db || Node Js)

2 年

Nice one boss

Emmanuel Amadiegwu

Software Engineer || Java || Kotlin || TypeScript || JavaScript

2 年

Great write up boss

要查看或添加评论,请登录

社区洞察

其他会员也浏览了