🧠 Network Protocols – Complete Notes
🌐 What Are Network Protocols?
Definition:
A network protocol defines a set of rules and conventions that govern how data is transmitted, received, and interpreted between two or more machines over a network.
Think of protocols as the languages computers use to communicate.
🧩 The OSI Model (7 Layers of Networking)
The OSI (Open Systems Interconnection) model organizes network communication into seven layers, each with a distinct role.
| Layer No. | Layer Name | Function | Examples |
| 7 | Application Layer | User-facing protocols & apps | HTTP, FTP, SMTP, WebSocket, WebRTC |
| 6 | Presentation Layer | Data formatting, encryption, compression | SSL/TLS, MIME |
| 5 | Session Layer | Manages sessions and connections | NetBIOS, RPC |
| 4 | Transport Layer | Ensures reliable or fast delivery | TCP, UDP |
| 3 | Network Layer | Routing and addressing | IP, ICMP |
| 2 | Data Link Layer | Node-to-node data transfer | Ethernet, PPP |
| 1 | Physical Layer | Hardware transmission | Cables, NICs, Wi-Fi signals |
🧱 Focus Areas (For This Session)
We’ll focus mainly on two key layers:
Application Layer
Transport Layer
🕸️ 1. Application Layer
This is the topmost layer of the OSI model and interacts directly with end-user applications.
It has two main communication models:
🖥️ A. Client–Server Model
In this model:
Client requests data or services.
Server responds to those requests.
Communication is typically unidirectional (client → server).
🔹 Common Protocols:
| Protocol | Full Form | Description |
| HTTP (HyperText Transfer Protocol) | Used for web communication (e.g., browsing websites). | |
| FTP (File Transfer Protocol) | Used to transfer files between client and server. Has two connections: control and data. ⚠️ Data connection is not secure unless FTPS is used. | |
| SMTP (Simple Mail Transfer Protocol) | Used for sending emails between servers. | |
| WebSockets | Allows bi-directional communication between client and server in real-time (used in chat apps, live updates, etc.). |
🧠 Example:
Web Browser (client) requests a webpage using HTTP from a web server (e.g., Nginx).
WhatsApp Web, Telegram Web, and Google Meet signaling use WebSockets to maintain live, two-way connections.
🔄 B. Peer-to-Peer (P2P) Model
In this model:
Every node (computer or device) can act as both client and server.
Direct communication happens between peers — no central server needed.
Generally faster and more scalable for media sharing or real-time communication.
🔹 Common Protocol:
- WebRTC (Web Real-Time Communication) → Used in Google Meet, Zoom, and WhatsApp video/audio calls.
🧠 Example:
When you make a video call on WhatsApp:
Devices communicate using WebRTC for direct peer-to-peer streaming.
Signaling may still go through a central server to establish the connection.
🚚 2. Transport Layer
This layer handles the delivery of data between devices — deciding whether to send it reliably (TCP) or quickly (UDP).
⚙️ Protocols
| Protocol | Type | Characteristics | Use Cases |
| TCP (Transmission Control Protocol) | Connection-oriented | Reliable, ordered, and acknowledged. Ensures every packet reaches its destination in the right order. | Web apps, file transfers (HTTP, FTP, SMTP). |
| UDP (User Datagram Protocol) | Connectionless | Fast, lightweight, no error checking or acknowledgment. May lose packets but reduces latency. | Live streaming, gaming, voice/video calls (e.g., WhatsApp, YouTube Live). |
🧩 Comparison of TCP vs UDP
| Feature | TCP | UDP |
| Reliability | High (retransmits lost packets) | Low (no retransmission) |
| Ordering | Maintains packet order | No guarantee |
| Speed | Slower | Faster |
| Overhead | More | Less |
| Use Case | HTTP, FTP, Email | Video Calls, Gaming, Live Streams |
📞 Real-World Examples
| Application | Protocol Used | Description |
| Google Meet | WebRTC (over UDP) | Real-time video/audio data via P2P + signaling via HTTP/WebSocket |
| WebRTC + WebSockets | WebSocket for chat, WebRTC for calls | |
| YouTube Live | UDP | Low-latency streaming |
| Gmail | SMTP + HTTP | SMTP for sending, HTTP for UI interaction |
| FTP Client | FTP (TCP-based) | File uploads/downloads |
🧭 Diagram (Concept Overview)
(Text-based representation — can generate image if needed)
+-----------------------------------------------------+
| Application Layer |
| (HTTP, FTP, SMTP, WebSocket, WebRTC, etc.) |
+-----------------------------------------------------+
| Transport Layer |
| (TCP - Reliable) (UDP - Fast, Unreliable) |
+-----------------------------------------------------+
| Network Layer (IP) |
| Handles routing & addressing |
+-----------------------------------------------------+
| Data Link & Physical Layers |
| Transmit bits over physical media |
+-----------------------------------------------------+
📘 Recommended Learning Resources
🎥 YouTube Playlists
Network Protocols for Developers – freeCodeCamp.org
Computer Networking Full Course – Telusko
WebRTC Deep Dive – Fireship
How WebSockets Work – Web Dev Simplified
📚 Blogs & Docs
MDN Web Docs – HTTP Overview
WebRTC Official Guide
Real-Time Communication Architecture (Google Developers)
🧩 Key Takeaways
Protocols = Rules of communication between systems.
Application layer defines what service is provided (e.g., HTTP, WebRTC).
Transport layer defines how data is delivered (e.g., TCP or UDP).
Client–Server = Centralized control; Peer-to-Peer = Direct, fast communication.
Modern apps (Google Meet, WhatsApp) use WebRTC and WebSockets for real-time interaction.