IDRASAcademic OS
CS402 • CANONICAL ACADEMIC TEXTBOOK3 Units • 3 Topics • Verified Multilingual Labs

Computer Networks & Protocols: Digital Knowledge & Laboratory Textbook

OSI 7-Layer stack, packet encapsulation, TCP/IP flow control, IPv4 subnetting, Dijkstra routing, and network cryptography.

Table of Contents1 of 3
Unit 1: Network Architecture & Physical Layer
Unit 2: Transport Layer Protocols & Reliability
Unit 3: Network Layer, IPv4 Subnetting & CIDR
Unit 1 • Chapter 1Estimated Study Effort: 35 minsBASIC

OSI 7-Layer Architecture & Packet Encapsulation Mechanics

Protocol Data Units (PDUs): Application Data -> TCP Segment -> IP Packet -> Ethernet Frame -> Physical Bits.

Learning Outcomes & Core Objectives:
["Analyze OSI 7-layer and TCP/IP protocol architectures","Trace socket state machines and flow/congestion control loops","Solve subnetting and routing algorithm equations"]
Conceptual Intuition and Real-World Mental Model (Hinglish)

What Problem Does This Architecture Solve?

Sending a letter: You write a note (Application), put it in an addressed envelope (Transport/Network), hand it to a postal courier in a delivery truck (Data Link/Physical). The recipient's post office opens outer boxes first, delivering the raw note intact.
Formal Technical Definition and Notation

Rigorous Specification, Assumptions and Invariants

Encapsulation adds headers at each layer: Port addresses at Layer 4 (Transport), IP addresses at Layer 3 (Network), MAC addresses and CRC-32 Frame Check Sequence (FCS) at Layer 2 (Data Link).
Step-by-Step State Transition and Mechanism

Execution Trace and State Mutation Sequence

Data -> [TCP Hdr | Data] (Segment) -> [IP Hdr | TCP Hdr | Data] (Packet) -> [Eth Hdr | IP Hdr | TCP Hdr | Data | FCS] (Frame) -> Voltage/Light pulses on physical wire
Worked Numerical and Dry-Run Walkthrough

Step-by-Step Numerical Example with Edge Cases

Detailed packet encapsulation and handshake trace demonstration.
Interactive Code Laboratory
main.pypython
import socket

# Raw socket demonstration of transport layer binding
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("google.com", 80))
http_request = b"GET / HTTP/1.1\r\nHost: google.com\r\nConnection: close\r\n\r\n"
s.sendall(http_request)
response = s.recv(512)
print("Received PDU payload:\n", response.decode("latin1", errors="ignore"))
s.close()
Production Systems and Industrial Engineering Relevance

How This Concept Powers Real-World Tech Infrastructure

Essential knowledge for site reliability engineering, backend distributed systems, and network security.

Topic 1 of 3