This post gives a brief overview of the role and types of application layer protocols.
Application protocols like Electronic Mail, HTTP, FTP etc. are the mechanisms used by computers to meaningfully exchange data between them, enabling end users to utilise the power of Computer Networks to communicate in a variety of ways. For example : to send electronic mail, the SMTP protocol is used ; to browse the internet, the HTTP protocol is used, to send files between computers, the FTP protocol is used etc. The list of such application layer protocols is endless and can go on and on.
The main duty of an application layer protocol is to use the network services provided by the underlying operating system running on a computer to exchange meaningful information with a peer application layer protocol residing on a remote computer, in order to faciliate a specific end user task. There are lots of standard based applications (E.g. HTTP, FTP, DNS, DHCP, SIP etc.) and also a wide variety of non-standard proprietary applications (e.g. Skype, Apple File sharing etc.) in existence.
An application layer protocol is just like any other protocol, with its own syntax, semantics and rules. As long as two machines understand the same application layer protocol, the machines should be able to communicate meaningfully for a specific purpose. Application layer protocols are written in high level languages like C, Java, etc. or in a wide variety of scripting languages like Python, Perl etc. These protocols communicate to the underlying network stack usually through TCP or UDP sockets.
In the Hybrid and TCP layering models, which are practically followed, application layer protocols do the triple duty of the session, presentation and application layers of the seven layer OSI model. That means that application layer protocols are not only responsible for the actual application specific intelligence, but also take care of formatting the data (encoding, compression etc.) and also take care of establishing sessions with peer computers whereever required.
Categorization of Application Layer protocols
Broadly speaking, application layer protocols can be classified either based on the underlying network services they use (e.g. TCP or UDP) or based on its relationship with its peer application layer (client- server or peer to peer).
Classification based on Underlying Network services used
As discussed in previous posts, there are two primary category of services provided by computer networks, namely i) a reliable connection oriented service in the form of TCP and its variants (e.g SCTP, T/TCP etc.) and ii) an unreliable best effort connectionless oriented service in the form of UDP and its variants. This is illustrated in the figure given below:
As seen in the figure above, protocols like FTP, HTTP, SMTP etc. require a reliable service ( even a single bit should not be lost inside the network) and hence such protocols go for TCP or its variants. Since TCP has mechanisms like acknowledgment, timeouts, retransmissions, it can guarantee that every bit of information sent by the sending node is received intact by the receiving node, inspite of packet losses in the network. But the tradeoff in TCP is that it cannot guarantee any time or delay limits for data delivery and also has connection establishment overheads. So those application layer protocols that are delay/time sensitive (e.g. real time voice/video applications), those applications that can tolerate occasional packet loss and those applications that have intelligence themselves to retransmit data whenever there is packet loss in the network use UDP as the underlying network service.
Additionally, there are many application layer protocols that use both TCP and UDP. For example, Voice over IP protocols use a reliable TCP channel for signalling purposes and an unreliable best effort UDP channel for actual data transfer.
Classification based on relationship with peer application layer
Another method of classification of application layer protocols is based on whether it is a client-server protocol or a peer to peer protocol. In client server protocols, the application layer protocol can be split into two sub-protocols, one for the client side and another for the server side, with each sub-protocol running on different computers. A majority of the application layer protocols on the internet are client server based protocols. In a client server protocol, the server waits on a well known socket port and serves multiple clients, whenever clients initiate connections to them. Examples of client server protocols include HTTP, FTP, Telnet, SSH, DNS, DHCP etc.
The other category of application layer protocol is a peer to peer protocol, where there is no strict client server relationships between the communication nodes. Different types of peer to peer file sharing protocols are examples of peer to peer protocols that do not have separate client and server sub-protocols.
Some protocols like SMTP (Simple Mail Transfer Protocol) use both the client-server and peer to peer concepts. SMTP servers usually have both client and server side implementations. When an SMTP server wants to send a mail to a remote SMTP server, it behaves as a client and initiates a request to a remote SMTP server. On the other hand, the same SMTP server would accept new connections from remote SMTP servers, when they contact this server for sending mails whose recepients are served by this SMTP server.. In this context, the SMTP servers have a peer to peer relationship, in that they behave as both SMTP clients and SMTP servers, based on need basis.