IN this i will talk about how computer network works internet, what is protocols , and http ,ip , dns , how dns server works.
Network
Do you Know How can communicate through phone , how we can share files ? its all possible through computer network.
computer network is the system that explain how two or more device can connect to each other and we can perform various task like communication , file transfer etc , it can be wired, or wireless
example of wired is connect two device through ethernet.
example of wireless bluetooth, internet.
INTERNET
lets find out what is internet , its a group of interconnected network
like above its just a example of internet where this show internet its just a wider term of computer network, through internet we connect all our world.
Now Question arise how we can use this internet.
how we can use this internet?
to access the internet , first of all we need a to connect our device to a network by (wifi , internet), and need a browser.
How internet works?
as we know internet is a group of interconnected networks , but at the end we will connect our device to a another device (or a server ) to provide and request some service.
so there are many protocol(or set of rules) that is used to manage that thing like http,tcp,udp,smpt,ftp etc.
What is Protocol?
In internet, every work done should be follow a sets of rules like communicating , file transfer etc and this sets of rules called protocol, there are many protocol that exist and also we can make our own protocol.
now we understands protocols lets move to http
HTTP
HTTP stands for hypertext transfer protocol , its is used to access webpages in the internet. actually now its name not suit it because in early stage of internet webpage contain only text and hypertext ( a link text that redirect to another resource) so this reason its gets its name. but now we can send multiple files , video , image etc, by using updating version of http.
HYPERTEXT = a webpage that contain hypertext ( a link text that redirect to another resource).
TRANSFER = Refers to the transmission of data (such as web pages, images, or multimedia) from a server to a client (like a browser).
PROTOCOL = its have some our own set of rules to transfer data.
Work Of HTTP ( client and server )
first of all , client(or browser) sends a HTTP request to the server.
Request contain
Method: Action to perform (e.g.,
GET
,POST
,PUT
,DELETE
) ( its also called verb).URL: Resource address (e.g.,
/index.html
).Headers: Additional metadata like client detail,browser info, cookie to store, date and time.
Body (optional): Data sent with the request (e.g., form data for a
POST
request).
after that server process the request and give a response to client.
response contain
Status Code (or response code): Indicates the outcome of the request (e.g.,
200 OK
,404 Not Found
).- Headers: Provide metadata (e.g., content type, length, cookies).
NOTE - server is just a device that host your data on the internet.
STATELESS PROTOCOL
HTTP use stateless protocol means every time you open a same website so you are a new user. it doesn’t store any detail about you.
so overcome this session and cookie is used to store your data and tell the server who are you.
like your login information saved on cookie every time you don’t need to login your acc to use instagram, facebook etc also if someone have your cookie and it can also gain the access of your data.
HTTP/2
its a updated version of HTTP/1.1 that introduce many feature like
Its use multiplexing ( means it can request and response multiple files at a time)
it use compression ( means make the size of data smaller like if you send 4 mb after compression its 1mb)
its use http/1.1 as a fallback ( like if http/2 not work, then http/1.1 will do that work )
its also support encryption ( means https like its exchange data in readable form ).
IP ( INTENET PROTOCOL )
do you ever know that there are many servers and devices which host multiple websites ,apps and multiple users send request to access information that is hosted in different servers in the internet. but how internet will find that server in millions of servers ?
IP address contain address of devices that use internet , its just a number like 192.168.123.132.
its contain the information in which network where is device is connected and which device it is, its mainly have 2 component , network id and device id.
but wondered like where we use this, we actually type the website name like chaicode.com and get the information about this how?
developers know that learn and remind the IP address is very difficult for a human so its introduce DNS ( domain name system ) in we can actually given a name to a IP address that also called URL or domain name
example google.com , this domain name is mapped with the IP address of server where its is hosted.
Now lets talk about full process of DNS system like how browser is find the IP address through DNS system.
DNS
DNS work as the phonebook of domain name. that know the IP addresses of all the domain names( website url). so lets find how its work properly.
claims - i use this image from google its not my
step-by-step.
Step 1: Request to DNS Resolver
When you type a domain name (e.g.,
google.com
) into your browser, your computer sends a query to a DNS Resolver (usually provided by your ISP or a public DNS service like Google DNS).The resolver's job is to find the IP address corresponding to the domain name.
Step 2: Query to the Root Server
If the resolver doesn't already know the answer, it sends the query to a Root Server.
The Root Server doesn't know the exact IP address but points the resolver to the Top-Level Domain (TLD) Server responsible for the domain.
Step 3: Query to the TLD Server
The resolver then queries the appropriate TLD Server (e.g.,
.com
,.org
,.net
).The TLD Server directs the resolver to the Authoritative Name Server for the specific domain.
Step 4: Query to the Authoritative Name Server
The Authoritative Name Server contains the final mapping of the domain name to its IP address.
It responds to the resolver with the correct IP address of the requested website.
Step 5: Resolver Sends the IP Address
- The DNS Resolver sends the IP address back to your computer.
Step 6: Request to the Website's Server
- Your computer uses the provided IP address to send a request to the website's server.
Step 7: Access the Website
- The website's server responds to your request, and the webpage is displayed on your browser.
this whole process called DNS resolution .
this is the end i will write another article that explain TCP , UDP in detail.