First things first - What is a Network Protocol?

Two systems/devices on a network in order to communicate with each other, they should speak a common language or use a common set of rules - just like humans speaking same language understand what other person is saying. So, this set of rules can be called as a Network Protocol. In this article, we will go through typical protocols, scenarios which we encounter day to day in Web Application building, and try to understand why particular protocol preferred to others.

What are the different protocols available? Many - like HTTP, HTTPS, FTP, SMTP, SSH, WebSockets etc.

Typically these protocols have 7 Layers

  • Application - this defines the main Protocol (HTTP / HTTPS / etc.)
  • Presentation
  • Session
  • Transport - underlying connection layer protocol (TCP, UDP)
  • Network
  • Data Link
  • Physical

Typically the Application layer and Transport layer need to be understood on how things operate, so that we can pick the right choice.

Communication Scenarios

Lets understand them from how systems communicate with each other.

Client-Server

Here, we basically have Client (browser or any app) initiating the connection with the Server, and Server will send the response. These are the protocols that fall in this category.

  • HTTP/S
  • FTP
  • SMTP
  • WebSockets

Peer to Peer

In this case, clients can talk to each other without any middleman (server). However clients will take help of server to recognize the other client on the network, and then only your Peer to Peer connection gets established. The following protocols fall in this category.

  • Web RTC

Application layer

HTTP - One Connection is made everytime a client wants to communicate with the Server. Once the communication is done, the connection is destroyed. The communication is encrypted here. If you add TLS (SSL) encryption to requests/responses, this will be HTTPS. Typically used for Web Page requests, API calls etc.

FTP - Two connections are made (Control, Data) when first time communicated. Data connection is made whenever there is communication. However the communication is NOT encrypted here. Used for file transferring clients connections.

SMTP - This protocols is on the domain of Emails. This operates along with POP3 or IMAP. POP3 destroys the email once read on any client., but IMAP doesn’t do that - helping you access the email from multiple clients. Typically communication line:

user agent (app) —> Message Transfer Agent (MTA) client —> Message Transfer Agent (MTA) server —> other user agent (app)

Web Sockets - This is also a client-server communication model. Two clients cannot talk to each other here. Think of this as an optimized HTTP connection - where you don’t need to create connection everytime - it’s like a pipe between client and server. Both can send data to each other. This helps in cases where we need real time updates, where server can send the updates as soon as it has any - instead of client requesting updates everytime.

Web RTC - In this connection, any system on the network can talk to each other whether it’s a client or a server, doesn’t matter. This is faster than having a middleman right which WebSockets protocol uses.


Transport layer

There are different protocols in this layer. Based on what Application layer is being used, the related Transport protocol gets used.

TCP - Basically a virtual connection is maintained between the two parties, through which data is moved in packets. There is acknowledgement for all packets. The ordering of the packets and the connection during the communication is maintained. If any packet loss happens, it’s sent again. The goal of this kind of connection is to never lose the data and the order should be maintained.

UDP - People refer to this in a fun way as “Fire and Forget”. The data is split into datagrams, and multiple connections are made, each sending a datagram. Here, we don’t care if a particular datagram is received or not. There is no acknowledgement involved, no connection / ordering maintained. Use cases like video calling where you don’t want some old lost video frame to pop up now - is where this type of communication suits. Data loss is totally ok - that doesn’t mean we don’t need the video at all - that would be a problem in your software system. We are talking about some minute parts of communication data misses.

Now that we know the Application layers, and Transport layers lets see how they are used.

HTTP/HTTPS - obviously we need no data loss for this. So it should be using TCP.

Web RTC - video calling scenario - this should be using UDP.

Web Sockets - no data loss expected - so TCP!


Didn’t want to give the extended form of abbreviations to offer simplicity in the topic. These are the details:

HTTP : Hyper Text Transfer Protocol

FTP : File Transfer Protocol

SMTP : Simple Mail Transfer Protocol

TCP : Transmission Control Protocol

UDP : User Datagram Protocol

IP : Internet Protocol

SSL : Secure Socket Layer

TLS : Transport Layer Security

Hope this brought some good level of understanding on Network Protocols. Follow for more!