Introduction to Servers and Clients

Neelakshi Lahiri
Last Updated: May 13, 2022

Introduction

Who doesn’t love eating out? 

I’m pretty sure almost everyone does, so let us consider we’ve gone to McDonald’s. There, we place our order at the counter and wait for it to be served to us. 

Servers and clients work in a similar manner. A client initiates a request for services, and a server provides it. Thus, an analogy can be drawn between a customer placing an order at McDonald’s and a client requesting a service from a server. 

Now, at McDonald’s, we only place the order while the staff carries it out. So, there is a division in the tasks. This gives rise to a network of different people involved. 

Similarly, when a client makes a request, both the client and the server have different tasks where the server uses different programs to carry out a request. This is called a client-server model or client-server architecture. 

Next, while placing an order at McDonald’s, we will communicate either in English or the local language. 

In servers and clients, communicate using the TCP/IP protocol suite.


                                                                                           Source: Omnisci

So far, we have just learnt what servers and clients are, but there’s a lot more than just their definition. In the subsequent sections of this article, we’ll learn the rest. 

Categories of Client-Server Models

Servers and clients can be of four different categories depending on the divisions in the tasks. 

One-Tier Architecture

This consists of a simple program running on a single computer without having to access the network. 

To understand this, let’s take the example of a person living alone. If they want to have a burger, they will make it for themselves without requesting anyone else.

Two-Tier Architecture

This consists of a client, a server and a protocol linking the two. 

An example to understand this would be a person placing an order at McDonald’s. The person is the client, and McDonald’s is the server that is fulfiling the client’s request.

Three-Tier Architecture

This architecture has three layers - the client layer with the UI (presentation tier), the service layer, which processes a client’s requests (application tier) and the database server that stores information (data tier). 

Let us consider a practical example to understand this architecture. Suppose we place an order at McDonald’s using an online food delivery service like Swiggy. Here, we are the client present in the client layer, Swiggy is in the service layer and processes our request, while McDonald’s is the server providing us (the client) the food (for a computer system data). 

N-Tier Architecture

To understand this, suppose you wish to have a burger from McDonald’s, and you tell your mother that. She tells your father, who then sends your brother to McDonald’s. Thus, your request is fulfilled but through N number of people. 

N-tier architecture is similar to such a scenario where an application is divided into logical layers, with separate responsibilities and manage dependencies, and physical tiers, which run on separate machines.

Now that we know a bit more about servers and clients let’s learn how they work.

Working of a Client-Server Model

To understand how a client-server model works, let us take the example of opening a URL. 

You may already know that various files are associated with a single web page and hosted on a server. So when we are opening a link, how are all those files fetched and opened within seconds? Let’s see how, step by step.

  1. We (the client) enter a URL.
  2. The browser requests the DNS server (Domain Name System).
  3. The DNS server looks up the Web server’s address and returns the IP address of the Web server.
  4. The browser sends an HTTP/HTTPS request to the Web server’s IP address.
  5. The server sends the necessary files of the webpage.
  6. The browser renders the files to display the webpage.


Advantages and Disadvantages of Servers and Clients

We’re learning about servers and clients, but do we know why they are essential?

Servers and clients come with many advantages. They are listed below.

  • Data present in a single server facilitates easy protection and management.
  • Network segments, servers and clients can easily be added without any disruption in the functioning of the already present network.
  •  Data can be accessed without proximity.
     

With advantages come disadvantages. Some disadvantages of servers and clients are:

  • Clients are susceptible to viruses, trojans and worms if present or uploaded to the server.
  • Servers are prone to Denial of Service (DOS) attacks.
  • Data packets may be spoofed or modified during transmission.
  • Phishing or capturing login credentials or other useful information of the user. 
  • MITM(Man in the Middle) attacks.

Frequently Asked Questions

  1. What are a client and a server?
    A client is a computer that receives information or uses a particular service from a server.
    A server is a remote computer that provides data or access to particular services.
     
  2. What is a client-server model?
    The client-server model is a collection of clients and servers where tasks are divided between them. The servers and clients either reside in the same system or communicate through a network or the Internet.
     
  3. Give some examples of client-server applications.
    Some examples of client-server applications are:
    Email
    World Wide Web
    Network printing
     
  4. What are the four categories of client-server models?
    The four categories of client-server models are:
    One-tier architecture
    Two-tier architecture
    Three-tier architecture
    N-tier architecture
     
  5. What is the difference between client-server and peer-to-peer networking?

Client-Server

Peer-to-peer

Each device has a specific roleAll devices have an equivalent capability.
They can manage applications and data in a centralized location which is an advantage over p2p networks.They provide an advantage over client-server networks through the flexibility to expand and handle many clients. 

 

 

Key Takeaways

In this article, we got an introduction to servers and clients. We learnt what they are, their different types, how they work, and their advantages and disadvantages. 

With this basic knowledge, we can dive deeper into backend development.

If you already know front end development, this is the beginning of backend development which will help us become a full stack developer. 

Don’t worry if you don’t know much about frontend development, but do make sure to check out relevant articles here.

Apart from that, you can practice common questions asked in coding interviews on CodeStudio and read about the interview experience of other successful people. 

Was this article helpful ?
0 upvotes

Comments

No comments yet

Be the first to share what you think