DEV Community

Cover image for How Internet Search Works
Jayant
Jayant

Posted on

How Internet Search Works

When we search for any website over the internet, there are many process that occurs to get our desired result.

Here are the steps :

  1. DNS Resolution
  2. Establishing a TCP connection
  3. Sending HTTP Request

DNS Resolution - This step invloves converting the domain name to the IP Address. when someone enters a URL in the browser, then a request is sent to the DNS serves which reverts with the IP Address. The IP address tells us where the server is present which hosts the particular website.

DNS Resolution

Establishing a TCP Connection - After we get the IP Address , Our browser initiates a TCP connection with the web server at that IP Address. This process involes a 3-way handshake.

  1. SYN(synchronize) Packet - Our browser sends a SYN packet to the server to initiate the connection. It is the 1st packet sent from client to server. It contain serveral fields such as source port, destination port, sequence number [ It is used to ensure the data integrity. ]
  2. SYN-ACK (Server to Client) - The server responds with a SYN-ACK packet, acknowledging the client’s SYN and providing its own initial sequence number.
  3. ACK (Client to Server): The client sends an ACK packet back to the server, acknowledging the server’s SYN-ACK. This completes the handshake, and the connection is established.

A Established TCP connections ensures that the data is transmitted properly. But TCP can't dictate how is data is structured and interpreted , so we use HTTP on the top TCP. HTTP (Hypertext Transfer Protocol) operates on top of TCP. Since HTTP is a stateless protocol, it relies on TCP to maintain the order of data transmission. Without TCP's sequencing mechanism, the HTTP protocol wouldn't guarantee that web pages and resources are delivered and rendered correctly.

Sending HTTP Request - After Establishing the TCP connection our browser sends the HTTP request to server. The Request got processed on the server and send the response which is then rendered by the browser.

Extras

  1. HTTP is stateless, meaning each request-response cycle is independent of previous interactions. It follows a request-response model.
  2. Websocket is also a communication protocol that provide full-duplex communication over single TCP connection. It enables real-time, bidirectional communication between a client (such as a web browser) and a server.
  3. TCP is a Transport layer protocol & HTTP or websockets are Application layer protocol.

Top comments (0)