
The OSI model has seven layers. Let’s start at the Application layer.

Layer-7:Application Layer.
An application layer where the user interacts with the network communication means the user prompts the network-aware application(Firefox, Google Chrome, Outlook, etc.) to access something over the network Like web applications, Emails, File transmissions, etc.
Lots of protocol works on Application layer Like Http,Https,FTP, SMTP ,Telnet,POP etc etc .

Each and every protocol has its own set of rules, HTTP is used for the web, and SMTP has been invented for mail communications.
The application layer basically displays the data which the user wants to access over the network.
Let’s say you are trying to access some files from a webserver.So you open up your web browser and type in the URL of your website. Your computer will send a message to the webserver requesting a certain web page. You are now using the HTTP protocol which lives on the application layer.
Layer-6:Presentation Layer.
Once the Application layer has completed its work, Then the presentation layer will structure the information of the application in a certain format
Presentation layer Performs translation of cross-platform standards that may be understood by the local machine: Pictures into .jpg,.png and .wav into .mp3 etc.
Presentation Layer formatting data at the source device into a compatible form for the receiving device and is Responsible for compressing data and it is also responsible for encrypting data.
Data Encryption and Decryption: Encryption is needed for security purposes when sending data across networks. An encryption algorithm is used during transmission, while a decryption algorithm is used at the receiving node. Encryption and decryption typically involve the secure sockets layer (SSL) protocol, which has become more popular when used by the presentation layer.
The presentation layer will make sure that information is readable for the application layer by formatting and structuring the data. Most computers use the ASCII table for characters. If another computer would use another character like EBCDIC then the presentation layer needs to “reformat” the data so both computers agree on the same characters.
Layer-5: Session Layer.
The session layer takes care of establishing, managing, and termination of sessions between two hosts. When you are browsing a website on the internet you are probably not the only user of the web server hosting that website. This webserver needs to keep track of all the different sessions. Session layer Creates and maintains dialogs between source and destination applications.
Normally when you access a server in multiple tabs of your browser, each and every tab is going to create a separate session.
Let’s you open a google.com in one tab, youtube.com, in another tab, and Facebook is another tab they all are going to be differentiated by some sort of session id. So each and every tab is going to do some unique task so that each and every session’s data is going to display in their respective tab. So the computers keep track of all sessions.
Some well known ports are there , Like HTTP-80,https-443,telnet-23 etc etc .
Data Flow from Application to Session layer.
Every time you do anything and you store anything in the computer that stores in the format of an electric signal and stored as an electrical code.
In an electrical signal the value is 0 and 1 . every time you do something in the computer that is stored as an electrical code.
Let’s say, you want to open a website in your browser and you went into the browser and type the website name you want to access .once you type the computer converted those data into binary to 0 and 1 and now it will go to the Presentation layer. Once those 0 and 1 will reach the presentation layer, it will do the encryption to it and it will add some additional bit into the data also the presentation layer does the decryption in the receiver end. Now the data will move to session layer, In session layer also it will add some bit into it . The session layer is going to assign a random port based on the application types. Now the packet will move to the transport layer and the transport layer will add some additional bits to it. That’s how Data encapsulation works.

These 3 layers we discussed as of now are considered upper layer and their PDU is called Data.