Understanding Request and Response Explained
Table of contents
In this blog we are going to understand:
What is a client?
What is a server?
Client VS Server:
Introduction:
Before diving into the concepts in a beginner-friendly way, let's start by addressing some common questions that arise when you use your browser. Where does all this information come from? How does it get to your screen? These questions often puzzled me, and it took years of studying computer science to understand how this intricate system works.
- What is a client?
Most simply a client is any device that needs something from another source so it requests to get it. The most common example here is when you open a new tab in your browser on any device and you type in the URL of the website let's say google.com and then you hit enter by hitting the enter button you are making what we call a request to a certain server.
- What is a server?
The server is another device that has the information you need to get. In this case the google.com home page. It's any party that owns a service which certain people request
- Client VS Server:
Let's make an analogy to simplify the concept more: let's say you want to eat a pizza so you go to a restaurant we can think of the restaurant here as your browser to make your food order (your request ) you need to go to a restaurant you choose a table and sit down, the waiter comes to take your order, here you will specify your details about your order, for instance, the size of the pizza the ingredients those specifications are universal and should be done whenever you want to order a pizza, which makes them like a protocol for pizza ordering, in the same way, the HTTP is the protocol that defines how the request you're going to send to the server is formatted. The format of an HTTP request includes the HTTP method (such as GET, POST, PUT, DELETE), the URL (Uniform Resource Locator) of the resource being requested, and headers that convey additional information, for the sake of simplicity we will take about the GET request which describes exactly what you want to do by ordering a pizza you want to get a pizza from the restaurant's kitchen which will be our server here. So let's break it down :
Client: You
Request: Ordering a pizza
Method: GET (You want to get food)
Server: Restaurant's kitchen
HTTP Protocol: Pizza ordering protocol
Now you've made your request the waiter writes down your order and takes it to the kitchen from where your food is going to be brought back to you by the waiter again. The food is the response here.
Response: Food
Waiter: Network
So whenever a device requests something from another party it is called a client and the one who is supposed to respond is called the server for this case.
Note: A client can also be a server and a server might be a client as well how is that? When the server who is the one giving a certain service starts to ask a third party for another service it becomes a client. Let's understand in the context of pizza when you made your order the restaurant might not have had time to prepare the pizza dough which is the dough used as the base for making pizzas, to its request pizza dough from someone who is specialized in making those in this scenario, the restaurant's kitchen who is considered as a server for you is a client in the communication between them and the dough pizza maker as a result this last is another server in this case.
If you found this helpful, please consider subscribing to our newsletter and hitting the like button to support the blog.
Subscribe to my newsletter
Read articles from Zainab JINARI directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Zainab JINARI
Zainab JINARI
A full-stack engineer and passionate website designer, experienced in creating projects from scratch. I’m in my 5th year studying Web & Mobile Application Engineering, and I’m also an enthusiast of AI and blockchain technologies. As a full-stack engineering student, I thrive on developing end-to-end solutions, from design to deployment..