EXERCISE
1One machine asks, another delivers. This simple pattern powers the entire internet.
Save
Client: The one making requests. Your phone, laptop, browser.
: The one doing the work. Handles business logic, stores data, runs computations.
Pattern: Client demands. Server delivers.
Opening Instagram:
Client (your phone): "Show me my feed"
Server (Instagram backend): Fetches posts from , returns them
Deleting a tweet:
Client (browser): "Delete tweet ID 12345"
Server (Twitter backend): Removes from database, confirms deletion
Sending email:
Client (Gmail app): "Send this email to user@example.com"
Server (Gmail backend): Queues email, sends it, returns success
Booking Uber:
Client (Uber app): "Request ride from point A to B"
Server (Uber backend): Matches driver, updates database, pushes notification
Every app works this way.
Centralized control: Update server once. All clients benefit immediately.
Security: Sensitive operations happen on server. Client never touches database directly.
Example: Banking app.
Your phone shows balance. But it cannot directly modify the database.
Server validates identity, checks permissions, executes transaction, updates records.
Client only sees results. Database stays protected.
Separation of concerns: Client handles UI. Server handles logic and data.
Scale: One server handles thousands of clients simultaneously.
Two machines must talk. They could be:
Data travels as packets over TCP/IP protocol.
Physical distance matters:
Server in same city? 10ms latency.
Server across country? 50ms latency.
Server on another continent? 200ms latency.
This is why CDNs exist. Content delivered from nearest server.
Peer-to-peer: Clients talk directly to each other. No central server.
Example: BitTorrent. You download video chunks from other users directly.
Why not always use this?
Complexity: Clients must discover each other, coordinate, handle security.
Trust: Cannot trust random peers. Who validates data correctness?
Consistency: How does everyone see the same version of data?
Most apps choose client-server for simplicity and control.
How do client and server actually exchange data?
They need a common language. Just like humans need English or Hindi.
Computers need protocols: TCP, HTTP, .
Understanding these is understanding the internet.