Client Server Architecture
It is important to understand client server architecture for any IT role.
Every major applications like amazon, facebook, instagram etc all functions based on client server architecture.
So what happens is client send data to server to process or request data from server and server return data to client.
In real life when you type amazon.com in your browser (client) and we have amazon (server) it will request some information from server and after getting response from server it will do necessary things
How browser get IP address of amazon server ?
So when we write any domain in our browser then behind the scene it make a DNS query to get IP address of amazon.com server
IP address
Is is nothing but a unique identifier of machine eg. Just like our house has an address to identify its location, a machine on a network has an IP address that uniquely identifies it
All the machines which are connected to internet can discover these public ip addresses and with the help of these we can send data packets in terms of bytes to these IP addresses
These IP address generally allocated by our cloud service provider eg. AWS or GCP to our machine
Get Adnaan Azam’s stories in your inbox
Join Medium for free to get updates from this writer.
To check the public IP address of any domain we can just write in terminal nslookup google.com this will return you public IP address of that server
eg. google public IP is 172.217.174.238 hit this will your browser this will open google.com
How data is being transferred from client to server
Client sent an HTTP request to the server (which means our browser will sent bytes of characters in form of packets) packet has two parts Header and Payload in payload we have our data in form of bytes and in header we have IP address of source and destination, destination IP address is required because server will need to know which IP address it should sent response to
Let’s say if we want to send character “A” over the network then first we need to convert into bytes below is the python code to convert character into bytes
char = "A"
byte_char = char.encode("utf-8")
print(byte_data) # b'A'The process of converting our data into bytes is know as encoding, so our packet will look like this
[Header: src=192.168.1.2, dst=142.250.183.206, port=443]
[Payload: b'A']Ports
The server listens for client requests on specific ports. Each port is represented using 2 bytes, so the total number of possible ports is 65,535
So when you want to communicate with server you need to specify the port number, if client uses HTTP protocol to communicate with server then default port will be 80 and 8443 for HTTPS
I would like to thank Himalay Majumdar, founder of ByteMonk, for creating an exceptional system design course . The code examples and images used in this demonstration are inspired by concepts from his course.
Thank you
A message from our Founder
Hey, Sunil here. I wanted to take a moment to thank you for reading until the end and for being a part of this community.
Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? We don’t receive any funding, we do this to support the community. ❤️
If you want to show some love, please take a moment to follow me on LinkedIn, TikTok, Instagram. You can also subscribe to our weekly newsletter.
And before you go, don’t forget to clap and follow the writer️!









