Application Layer in OSI Model

In this tutorial, you will learn the basic concepts of the Application Layer. After reading this tutorial, you will learn about the services provided by the application layer and the protocols used at the application layer.

Contents:

  1. Role of Application Layer
  2. Application Layer Protocols
  3. Presentation Layer and Session Layer
  4. Peer to Peer Connection
  5. Web Services
  6. Email Services
  7. IP Addressing Services
  8. File Transfer Services

Role of Application Layer

The application layer is one of the layers of the OSI model. It combines the functionality of the presentation and session layer in the TCP/IP model.

  • Generally, it provides an interface to the user whether it is a human or a software program that wants to access the services of the network.
  • Services like electronic mail, file transfer, web access, system resource access, and remote login, etc., are provided by the application layer.
  • In short, the application layer creates a user-friendly interface to interact with the application program. The application layer provides services to users through application programs running on the user’s machine.

The diagram below shows the application layer.

Application Layer

As shown in the figure, the application layer in the OSI model is divided into three parts, the application layer, the presentation layer, and the session layer, while in the TCP/IP model, the presentation layer and the session layer are present in the application layer.

The application layer has the following responsibilities.

advertisement
advertisement
  1. Peer to Peer Connection
  2. Web Services
  3. Email Services
  4. IP Addressing Service
  5. File Transfer

Application Layer Protocols

As we discussed, the application layer is the layer that interacts with end-user closely and provides interfaces between applications. The application layer uses a variety of protocols to exchange data between programs running on the source and destination hosts.

The diagram below shows the protocols of the application layer.

protocols of the application layer
  • As shown in the figure, HTTP, HTTPS, FTP, TFTP, DNS, DHCP, SSH, TELNET, IMAP, SMTP, POP, etc. are protocols of the application layer.
  • HTTP (HyperText Transfer Protocol) and HTTPS (HTTP Secure): For accessing web services.
  • FTP (File Transfer Protocol) and TFTP (Trivial FTP): For file transfer.
  • DNS (Domain Name System): For conversion of IP to the domain name and vice versa.
  • DHCP (Dynamic Host Configuration Protocol): Allocation of IP addresses.
  • SMTP (Simple Mail Transfer Protocol): For sending an email.
  • POP (Post Office Protocol) and IMAP (Internet Mail Access Protocol): To receive an email.
  • Telnet (Teletype Network) and SSH (Secure Shell): Remote Login.

Presentation Layer and Session Layer

The presentation layer and session layer are part of the application layer. When the application layer runs, the presentation layer and session layer activities are also involved in the process.

Presentation Layer: The presentation layer performs translation or formatting, compression, and encryption on the data.

  • Translation: When the user gives data to the application layer, the application layer communicates with the presentation layer and the presentation layer translates the data into a format compatible with the receiver.
  • Compression: Once the translation is done, the presentation layer compresses the data in such a way that the receiver can decompress it.
  • Encryption: After compression, data is encrypted by encryption methods and generates ciphertext so that it can be protected from attackers.
  • Basically, the presentation layer contains standards for file formats such as MKV (Matroska Video), MOV (Quicktime Video), Portable Network Graphics (PNG), and the Joint Photographic Experts Group (JPG or JPEG).

Session Layer: When the user is communicating with the application running at the application layer, the session layer creates a session for the user. It maintains dialog control and synchronization.

  • Whatever data the user exchanges in the application layer, the session layer handles all the exchange of information to initiate the dialogs.

The diagram below explains the services of the Application Layer, Presentation Layer, and Session Layer.

Services of Application Layer, Presentation Layer, and Session Layer
  • As shown in the figure, PC-1 generates a message for PC-2. Now, the presentation layer translates the message into a suitable format so that the PC-2 can understand the message once it is received.
  • After that, the presentation layer compresses the size of the data from 2MB to 200KB and encrypts the data.
  • Then the application layer running on PC-1 sends the data to PC-2. As the application layer of PC-1 sends data, the session layer initiates the session for communication.

advertisement

Peer-to-Peer Connection

In a peer-to-peer connection, the devices do not require a dedicated server. A peer-to-peer network has two parts, a P2P network, and a P2P application.

P2P Network: In a P2P network, no master-slave mechanism is used. This means that all devices can act as either a client or a server.

The diagram below explains the P2P network connection.

P2P network connection
  • As shown in the figure, PC-1 acts as a file server for PC-2 and PC-2 acts as a print server for PC-1.
  • When PC-2 wants to access the files, it sends a request to PC-1 for file transfer. In this case, PC-1 acts as the server, and PC-2 acts as the client.
  • When PC-1 wants to access a printer shared with PC-2, PC-1 sends a request to PC-2 to use the printer’s services. So, in this case, PC-1 and PC-2 act as client and server, respectively.
  • We can conclude that the roles of client and server are determined on a per-request basis.

P2P Application: In this, the resources shared with the client and the server are not centralized, but the indexes pointing to the resources are in a centralized directory.

  • When two peers are communicating with each other, they communicate with the index server to access the other peer’s resources.
  • BitTorrent, BitComet, uTorrent, Direct Connect, eDonkey, Freenet, Fastrack, Tribler, DC++, Emule, etc., are P2P applications.

advertisement

Web Services

The application layer provides a user interface to access web services simply with less effort.

The figure below explains the web service.

Web Services in Application Layer
  • As shown in the figure, the client types the URL of the website, and then a connection is established between the web server and the client.
  • Here, the HTTP protocol is used to route the client’s request to the HTML pages. Generally, GET, POST, and PUT messages are used.
    • GET, POST, and PUT are used to request a web service from a server, upload data files to a web server, and upload resources to the server, respectively.
  • Once the webserver gets the client’s request, it returns the HTML page to the client as a response.

The main two protocols used for web services are HTTP and HTTPS. Both protocols use a request-response cycle but the data stream is encrypted in HTTPS using the Transport Layer Security (TLS) protocol or the Secure Sockets Layer (SSL) protocol. Hence, HTTPS is more secure than HTTPS.

Email Services

Email is one of the primary services of the application layer, and it uses a store-and-forward mechanism. When the email is sent by the sender, it is stored in the mail server, and the recipient accesses the email from the mail server. Generally, email service is offered by an Internet Service Provider (ISP).

The below diagram explains the email service.

Email Services in Application Layer
  • As shown in the figure, the sender wants to send an email to the recipient. For that, the sender writes the recipient’s email address in the message so that it is received by the appropriate recipient.
  • Email messages are protected by the Transport Layer Security (TLS) protocol.
  • The application layer has set the SMTP (25) port to send the email. Once an email leaves the sender’s application layer, it travels through the router and reaches the mail server.
  • The mail server is the intermediate between the sender and the receiver. The mail sent by the sender is not going directly to the recipient. It first reaches the mail server.
  • Once the email arrives on the mail server, the recipient uses the POP3 (110) or IMAP (143) protocol to receive the mail from the mail server.
  • So we can say that SMTP protocol is used to send an email, and POP3 or IMAP protocol is used to receive email from a mail server.
  • Basically, POP is not recommended for small businesses, as they want to back up emails. In this case, they can use IMAP to receive the email because in IMAP, a copy of the original mail is sent to the recipient, and an original email is stored in the mail server.

IP Addressing Services

When you connect to a network, an IP address is assigned to you automatically. This is known as dynamic host configuration. The DHCP (Dynamic Host Configuration Protocol) server operates on port number 67 and is used to dynamically assign an IP address to the host. Also, static IP allocation is used in which the network administrator or engineer has to specify the IP address to host statically.

  • DHCP servers are located at different locations on the network. They have an IP address pool in which the configured IP address range is stored.
  • The IP assigned to the user is temporary. If the same user connects to a network multiple times, each time he/she gets a unique and different IP address.
  • After the communication ends, the IP address is de-allocated.
  • The DHCP server sets the time, known as the lease period time. At the end of the lease time, the IP address gets de-allocated and can be reused for any other host.

The figure below explains the IP addressing service.

IP addressing service
  • As shown in the figure, there are three DHCP servers. The router can also act as a DHCP server.
  • A request is made to the DHCP server for an IP address from the client, and the DHCP server assigns an IP address to the client.
  • Dynamic IP allocation is used for end-users, whereas a static IP allocation scheme is used in routers, switches, and servers.

File Transfer Services

The FTP and TFTP protocols are the primary protocols used at the application layer for file-sharing services. FTP is most common application layer protocol used for file sharing between devices.

The figure below explains the data transfer connection between the client and the server.

data transfer connection between the client and the server
  • As shown in the figure, the client sends a connection request to the server using TCP port 21.
  • Once the connection is established, the client sends TCP port 20 for a data transfer connection to the server. It uses TCP port 20 each time the client wants a data transfer service.
  • After the data transfer connection is established, the client can download and upload data to and from the server. Downloading data from the server is known as pull, and uploading data to the server is known as a push.
  • Server Message Block (SMB) is another file sharing mechanism in which the server makes its resources available to the client.

Key Points to Remember

Here is the list of key points we need to remember about “Application Layer”.

  • Services like electronic mail, file transfer, web access, system resource access, and remote login, etc., are provided by the application layer.
  • The application layer is the layer that interacts with end-user closely and provides interfaces between applications.
  • HTTP, HTTPS, FTP, TFTP, DNS, DHCP, SSH, TELNET, IMAP, SMTP, POP, etc. are protocols of the application layer.
  • The presentation layer and session layer are part of the application layer. When the application layer runs, the presentation layer and session layer activities are also involved in the process.
  • In a peer-to-peer connection, the devices do not require a dedicated server. A peer-to-peer network has two parts, a P2P network, and a P2P application.
  • HTTP and HTTPS are used for web services, FTP and TFTP are used for file-sharing services, SMTP, POP, and IMAP are used for mail services, and TELNET and SSH are used for remote login.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.