Computer Networks - OSI Model
Want to understand how internet works when a request is made. There are two important models for the working of Internet. I have explained OSI Model
In the previous blog, we looked at the origin of Internet and some terms related to computer networks. Here is the link if you didn't read it :- Computer Networks - Introduction
Introduction
Let me first give you an analogy on Structure of Networks.
As shown in the image above, let's say you want an authentic bottle of perfume from Dubai. You live in India and you want that perfume.
- You placed an order of the perfume, online from an ecommerce or online store.
- The store confirmed your order.
- They send it to their local delivery partner in Dubai.
- This delivery partner will then transport the perfume from Dubai to India.
- The perfume has arrived in India.
- It will be send to the local delivery partner in India.
This delivery partner will then transport the perfume to your current location.
Finally! You received the perfume that you desired for.
Just like this process from ordering an item to receiving it, you can image this how internet works.
Let's say you want to request for some specific thing from internet. For example you want to watch a video on How universe was formed?
from YouTube, so this video on specific topic will send a request to the YouTube server and in result, it will give you all the videos related to what you requested for.
So, to understand how this request works we will be diving deep into how internet really works when you request something from a web browser.
There are defined models/framework on which the internet works on. There are two types of model used in computer networks:-
- OSI Model
- TCP/IP Model
Here, I have discussed only OSI Model in short. I will discuss the TCP/IP Model in detail in next blog.
OSI Model
OSI Model (Open System Inter-connection Model) is a standard model for how applications like YouTube, Facebook etc. communicates over the internet. This model was proposed by ISO (International Standardization Organization). This model is a concept/framework/theoretical model which explains how any network requests works.
Let us discuss the structure of OSI Model. This model contains 7 layers through which a request of any type goes from. They are :-
- Application Layer
- Presentation Layer
- Session Layer
- Transport Layer
- Network Layer
- Data Link Layer
- Physical Layer
Here, I have discussed all Layers of OSI Model in brief. I will discuss the TCP/IP Model in more detail because it is the layer which is used in current networking scenario.
Application Layer
At the very top of the OSI Model, there is a layer called Application Layer. This layer is what you see when you interact with any website or an application. This layer is responsible for helping client to communicate to the server to access the data that is desired. For example: -
- Let's say you want to send a message to your friend. The interface of
Application
orWebsite
that you will be using to send the message is the Application Layer.
Presentation Layer
The Presentation Layer is also called Translational Layer. This layer is responsible for manipulating the data getting from the application and format it such that it can transmit or pass over to the network process. For Example: -
- After opening the messaging app, you typed a message and pressed the sent button. After that the data will go through some encryption/decryption and your data will be converted to 0's & 1's. This is done by Presentation Layer.
Session Layer
The Session layer is responsible for establishing a secure connection, maintenance of sessions or cookies, authentication and also ensure the security of the data, received and sent. For Example:-
- While the message is processing to be send after you clicked on send button, the application encrypts/decrypts the data. So that the data that you sent, not get lost in the process. This is ensured by Session Layer.
Transport Layer
The Transport Layer is responsible for end-to-end delivery of the complete request or message. The data at this layer or stage is called Segments. Here, transport layer attaches something called Port numbers (A unique number that is attached with IP-Address to identify a particular application or process) of both source and destination. It also ensures the data transmission and it re-transmits if an error occurs. it readies the data to send to the Network Layer. For Example:-
- After making sure that your message is secure, It adds a port number to the encrypted message and tries to establish a connection between your phone and your friend's/family's phone.
Network Layer, Data Link Layer, Physical Layer are called Lower Layer or Hardware Layer
Network Layer
The Network Layer is responsible for finding the shortest route path to send your message to the destination. It jumps from router-to-router to send your data in short period of time. It also attaches IP Address of both source and destination to identify each device. For Example:-
- After establishing connection, the IP Address of your phone and your friend's/family's phone is attached to the data to let router know that where the message should be sent. The Wi-Fi routers you use tries to find the shortest path to send your message in shorter time.
Data Link Layer
The Data Link Layer is responsible for dividing the data into small frames which network understands. It also attaches MAC (Media Access Control) address (A physical address of your Wi-Fi, Ethernet, Bluetooth and many more that requires network connection). To send or receive a message or data via network, MAC Address and IP Address are the most important. It also handles damaged or lost of frames and retransmits it.
Physical Layer
The last layer of OSI Model is Physical Layer. It is responsible to connect two or more devices on physical level. It contains the data in the form of bits. It defines that how data will flow from one device to another. It also specifies the physical topologies that they are arranged in.
This is the process of how a request is received and sent to the user. OSI Model is very important model to understand.
This was all from my side about Introduction to Programming.
Hope It was helpful.
Stay Tuned for more.
Thank you.