DEV Community

Mohammed Azim J
Mohammed Azim J

Posted on

A blog on "How a request originates from cllient and reaches the server "

Whenever we open a website, submit a form, or use a mobile app, a request is sent from the client to the server. This process happens very quickly, but several steps take place in the background to make it work.

The process starts from the client side. The client can be a web browser, mobile app, or any application that requests data. When a user enters a URL in the browser or clicks a button, the client creates a request. But before sending the request, the client must know the server’s IP address because computers communicate using IP addresses, not domain names. So the client performs a DNS lookup to convert the domain name into an IP address.

Once the IP address is found, the client establishes a connection with the server using TCP. This is done through something called the TCP three-way handshake, where the client and server confirm that they are ready to communicate with each other. After the connection is established, the client sends an HTTP request to the server. This request may be a GET request to fetch data or a POST request to send data.

The request then travels through multiple routers and networks on the internet until it reaches the server. The server receives the request, processes it, and prepares a response. The server might fetch data from a database, perform some logic, and then send the result back to the client as an HTTP response.

The response travels back through the internet to the client’s browser. The browser then renders the response, such as displaying a webpage, showing data, or confirming a form submission.

So in simple terms, the flow is: the user performs an action, the client sends a request, DNS finds the server IP address, a TCP connection is established, the request reaches the server, the server processes it and sends a response, and finally the client displays the result to the user. This entire process usually happens in just a few seconds, and this is how communication between client and server works on the internet.

Top comments (0)