6. Client-Server Architecture
What is Client-Server?
Client-Server architecture is a network architecture in which clients request services or resources from servers, and servers provide those services or resources.
In simple words:
Client asks → Server processes → Server responds.
Basic model:
Client │ │ Request ↓ Server │ │ Response ↓ Client
This architecture is used everywhere:
- Websites
- Mobile applications
- Online banking
- Cloud services
- Online games
- Databases
- File sharing
- APIs
- IoT applications
1. What is a Client?
A client is a device or software application that requests a service from a server.
Examples:
- Web browser
- Mobile app
- Email application
- Desktop application
- SSH client
- FTP client
- IoT device
For example, when you open a website:
Chrome/Firefox ↓ Request ↓ Web Server
Your browser is acting as a client.
Important
A client doesn't necessarily mean only a physical computer.
A program/application can also be a client.
For example:
Browser → Web Server
The browser is the client application.
2. What is a Server?
A server is a computer or software system that provides services or resources to clients.
Examples:
- Web server
- Database server
- DNS server
- File server
- Mail server
- Application server
- Authentication server
Example:
Client │ ↓ Web Server │ ↓ Website
A server typically waits for requests and responds to them.
3. Basic Client-Server Communication
Suppose you visit:
example.com
A simplified process is:
Client Browser │ │ Request ↓ Web Server │ │ Response ↓ Browser
Step 1 — Client creates a request
The browser requests a resource.
Conceptually:
GET /index.html
Step 2 — Request travels through the network
Browser ↓ Wi-Fi Router ↓ ISP ↓ Internet ↓ Server
Step 3 — Server processes request
The server determines what resource or operation is required.
Step 4 — Server sends response
Server ↓ HTTP Response ↓ Browser
Step 5 — Client displays/processes result
The browser renders the webpage.
4. Request and Response
The two most important concepts are:
Request
and
Response
Client Server │ │ │────── Request ──────────────>│ │ │ │ │ Processing │ │ │<────── Response ─────────────│ │ │
For HTTP:
Client → GET /products → Server Client ← 200 OK + data ← Server
5. Example: Opening a Website
Suppose you type:
https://example.com
A simplified process:
1. DNS lookup
Your system needs to find the server's IP address.
example.com ↓ DNS ↓ IP Address
2. Connection
Your client establishes the appropriate network connection.
3. HTTP request
GET /
4. Server processes request
The web server finds or generates the requested content.
5. HTTP response
HTTP/1.1 200 OK
along with the requested content.
6. Browser displays the page
Server → HTML/CSS/JS → Browser
6. Client-Server Example: YouTube
When you watch an online video:
You │ Phone/PC Client │ ↓ Internet │ ↓ YouTube Servers │ ↓ Video Data │ ↓ Your Device
Your device requests video data, and the service sends data back.
Large platforms normally use many servers, caches, CDNs, and other infrastructure rather than one physical server.
7. Client-Server Example: Online Banking
Banking App │ │ Login Request ↓ Bank Server │ ├── Authentication ├── Account Service └── Database │ ↓ Response │ ↓ Banking App
For example, when you request your account balance:
Client → "Give me my balance" Server → "Your balance is ..."
The real system involves authentication, authorization, databases, encryption, logging, and other security controls.
8. Client-Server Example: IoT
Suppose you have an ESP32 with a temperature sensor.
DHT11 │ ↓ ESP32 │ │ Wi-Fi ↓ Router │ ↓ Internet │ ↓ IoT Server │ ↓ Database
The ESP32 can act as a client by sending sensor data to a server.
For example:
ESP32 → Temperature: 28°C → Server
The server may store it in a database.
Later:
Phone → Request temperature → Server Phone ← Temperature data ← Server
So the same system can have multiple clients.
9. Types of Servers
Different servers provide different services.
Web Server
Provides web content over HTTP/HTTPS.
Browser → Web Server
Examples of web-server software include:
- Nginx
- Apache HTTP Server
- Caddy
Application Server
Runs application/business logic.
Client ↓ Web/API ↓ Application Server
Database Server
Stores and processes structured application data.
Application ↓ Database Server
Examples:
- MySQL
- PostgreSQL
- Microsoft SQL Server
File Server
Provides shared file storage.
PC1 ──┐ PC2 ──┼── File Server PC3 ──┘
DNS Server
Resolves domain names and provides other DNS records.
example.com ↓ DNS Server ↓ IP Address
Mail Server
Handles email-related services.
Email Client ↓ Mail Server ↓ Recipient Mail Server
Common protocols include:
- SMTP
- IMAP
- POP3
Authentication Server
Handles identity verification and authentication.
User ↓ Application ↓ Authentication Service ↓ Access Granted/Denied
10. One Client, Multiple Servers
A client doesn't necessarily communicate with only one server.
For example, opening a modern website may involve:
Browser │ ┌────────────┼────────────┐ ↓ ↓ ↓ DNS Web/API CDN Server Server │ ↓ Database
Different servers can perform different jobs.
11. Multiple Clients, One Server
A server can serve many clients simultaneously.
Server / | \ / | \ PC1 PC2 Phone
For example, a website may have thousands or millions of clients.
The server infrastructure handles many requests concurrently.
12. Multiple Clients and Multiple Servers
Large systems normally use multiple servers.
Clients / | \ PC Phone Tablet \ | / Load Balancer / | \ S1 S2 S3 \ | / Database
Benefits include:
- Scalability
- Availability
- Load distribution
- Fault tolerance
13. Client-Server Using Ports
A server usually listens for network connections on a particular port.
For example:
Web Server IP: 192.168.1.100 Port: 443
The client connects to:
192.168.1.100:443
Common examples:
| Service | Common Port |
|---|---|
| HTTP | 80 |
| HTTPS | 443 |
| DNS | 53 |
| SSH | 22 |
| FTP | 21 |
| SMTP | 25 |
| IMAP | 143 |
| POP3 | 110 |
Ports allow a host to provide multiple network services.
For example:
Server IP: 10.0.0.10 Port 22 → SSH Port 80 → HTTP Port 443 → HTTPS
You'll study ports separately later.
14. Client-Server and Protocols
Client-server communication requires protocols that define how communication occurs.
Examples:
HTTP/HTTPS
Browser ↔ Web Server
DNS
DNS Client → DNS Server
SSH
SSH Client → SSH Server
SMTP
Mail Client/Server → Mail Server
FTP
FTP Client → FTP Server
Protocols define rules such as:
- Message format
- Communication sequence
- Error handling
- Authentication
- Data transfer behavior
15. Stateful vs Stateless Communication
Stateless
The server does not inherently remember previous requests as part of the protocol interaction.
HTTP is traditionally described as stateless.
For example:
Request 1 → Server Request 2 → Server Request 3 → Server
Each request can be handled independently at the HTTP protocol level.
Applications can still maintain user state using mechanisms such as:
- Cookies
- Sessions
- Tokens
Stateful
The server maintains information about an ongoing communication/session.
For example:
Client │ ├── Connect │ ├── Authenticate │ ├── Request │ └── Disconnect
The exact meaning of "stateful" depends on the protocol or application.
16. Advantages of Client-Server Architecture
1. Centralized Management
Servers can centrally manage:
- Data
- Users
- Applications
- Permissions
- Backups
2. Better Security Management
Security policies can be centrally implemented.
3. Resource Sharing
Many clients can access the same service.
4. Scalability
Servers can be expanded or replicated as demand increases.
5. Centralized Backup
Important data can be stored centrally.
6. Easier Maintenance
Server-side applications can often be updated without installing changes on every client.
17. Disadvantages
1. Server Failure
If an important server fails, clients may lose access to the service.
Clients │ X Server DOWN
Redundancy can reduce this risk.
2. Cost
Large systems require:
- Servers
- Storage
- Network infrastructure
- Security systems
- Administration
3. Network Dependency
Clients generally need network connectivity to reach remote services.
4. Server Bottlenecks
Too many requests can overload a server if the architecture isn't designed to scale.
10 users → Fine 10,000 users → Possible overload
Load balancing, caching, replication, and scaling can help.
18. Client-Server vs Peer-to-Peer
| Feature | Client-Server | Peer-to-Peer |
|---|---|---|
| Central server | Usually yes | Not required |
| Management | Centralized | Distributed |
| Security management | Easier centrally | More difficult at scale |
| Scalability | Generally better | Limited for many traditional use cases |
| Cost | Higher | Lower for small/simple networks |
| Backup | Can be centralized | Often distributed |
| Example | Websites | Direct peer sharing |
19. Thin Client vs Thick Client
This is another important concept.
Thin Client
A thin client performs relatively little processing locally and depends heavily on servers.
Thin Client │ ↓ Server │ ↓ Processing/Data
Examples can include browser-based or remote desktop environments where most application processing happens remotely.
Advantages
- Easier centralized management
- Less powerful client hardware may be sufficient
- Centralized data
Disadvantages
- Strong dependence on network/server
- Server infrastructure can be expensive
Thick Client
A thick client performs substantial processing locally.
Thick Client │ ├── Local Processing ├── Local Storage │ ↓ Server
For example, a desktop application may process much of the data locally while using a server for synchronization or storage.
20. API Client-Server Architecture
Modern applications commonly communicate through APIs.
Mobile App │ │ API Request ↓ Backend API │ ↓ Database
For example:
GET /api/users
The server might return:
{ "name": "Uday", "age": 21 }
The mobile/web application then uses the response.
21. Security in Client-Server Communication
Client-server systems need security at multiple levels.
Authentication
Who are you?
Username + Password
Authorization
What are you allowed to do?
User → Read Admin → Read + Write + Delete
Encryption
Protects data while traveling across the network.
For web communication:
HTTPS ↓ Encrypted communication
Firewall
Controls network traffic.
Access Control
Limits which users/clients can access which resources.
22. Complete Real-World Example
Suppose you build an online student portal.
Internet │ ↓ Firewall │ ↓ Load Balancer / \ ↓ ↓ Web Server 1 Web Server 2 \ / ↓ ↓ Application Server │ ↓ Database
Student's laptop
Laptop ↓ Browser ↓ Request
Server side
Request ↓ Web Server ↓ Application Server ↓ Database ↓ Response
Response
Database ↓ Application Server ↓ Web Server ↓ Browser ↓ Student
This is a practical example of client-server architecture.
The Most Important Flow
Remember this:
CLIENT │ │ Request ↓ NETWORK │ ↓ SERVER │ Processing │ ↓ RESPONSE │ ↓ CLIENT
And remember the key terms:
| Term | Meaning |
|---|---|
| Client | Requests a service |
| Server | Provides a service |
| Request | Message asking for a service/resource |
| Response | Server's reply |
| Protocol | Rules for communication |
| IP Address | Identifies a network interface/location at the IP layer |
| Port | Identifies a service/application endpoint on a host |
| Authentication | Verifies identity |
| Authorization | Determines permissions |
One-line definition for exams
Client-server architecture is a network architecture in which client devices or applications request services or resources from dedicated server systems, which process the requests and return responses.