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:
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;
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
领英推荐
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;
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:
Software Engineer (JavaScript || React Js || Typecript || Next Js || Express Js || Mongo Db || Node Js)
2 年Nice one boss
Software Engineer || Java || Kotlin || TypeScript || JavaScript
2 年Great write up boss