Full PDF content + RDT deep comparison + Handshake & Checksum examples
📄 Chapter 3 (full summary v1) + extended sections — organized by original PDF order
📖 page 1⚙️ transport layer services & protocols
1. Transport Layer Services & Protocols
The transport layer provides logical communication between application processes on different hosts. It relies on network layer and enhances it for application use.
✂️ Segmentation
Breaks app messages into smaller units → segments
Passes them to network layer
🔄 Reassembly
On receiving side: reassembles segments into original messages
Delivers to correct application process
🌐 Key Internet Protocols
TCPUDP
🔄 Transport vs. Network Layer
Network layer: logical communication between hosts.
Transport layer: logical communication between processes (applications).
Transport enhances host-to-host delivery with process-level multiplexing.
طبقة النقل: توفر اتصالاً منطقياً بين العمليات (التطبيقات). التقسيم (segmentation) على المرسل وإعادة التجميع على المستقبل. البروتوكولات الرئيسية: TCP و UDP. طبقة الشبكة تواصل بين الأجهزة، طبقة النقل تواصل بين العمليات.
📖 page 2🔀 multiplexing/demultiplexing · UDP
3. Multiplexing & Demultiplexing
📤 Multiplexing (Sender)
Gathers data from multiple sockets
Adds transport header (source/dest ports)
Prepares segments for network layer
📥 Demultiplexing (Receiver)
Examines header (ports)
Delivers segment to correct socket → process
4. UDP: User Datagram Protocol
Connectionless & unreliable — no guarantee of delivery or ordering.
Note: matching checksum does not guarantee no errors (only detection).
✅ UDP lightweight: no handshake, no connection state, minimal overhead. Used for streaming, DNS, SNMP.
Multiplexing: جمع البيانات من عدة sockets وإضافة رأس (ports). Demultiplexing: تسليم البيانات للعملية الصحيحة. UDP: غير موثوق وغير متصل، يقدم checksum لاكتشاف الأخطاء فقط.
📖 page 3📡 Reliable Data Transfer · Pipelining
5. Principles of Reliable Data Transfer (RDT)
Building reliable transfer on top of an unreliable channel. Complexity depends on underlying channel characteristics.
✅ Core RDT Principles
Error Detection
Acknowledgment (ACK)
Retransmission
Sequence Numbers
Flow Control
📈 RDT Evolution
rdt2.0/2.1/2.2: bit errors, ACK/NACK, sequence numbers (avoid duplicates).
rdt3.0: handles loss + errors → countdown timer; retransmit if ACK not received.
📊 Detailed Comparison: rdt2.0 / 2.1 / 2.2 vs rdt3.0
Protocol
Handles Bit Errors?
Handles Packet Loss?
ACK/NACK Scheme
Sequence Numbers
Timer / Retransmission
Key Limitation / Improvement
rdt2.0
✅ Yes (checksum)
❌ No
ACK + NACK (explicit negative ack)
❌ No seq numbers
No timer (assumes no loss)
Fails if packet lost; cannot handle duplicate packets due to no seq#
rdt2.1
✅ Yes
❌ No (still assumes loss-free channel)
ACK and NAk
✅ 0/1 seq bits
No timer, but seq numbers prevent duplicate delivery
Solves duplicate problem but still no loss recovery
rdt2.2
✅ Yes
❌ No (loss not handled)
ACK‑only (no NACK, uses ACK for last received packet)
✅ seq # 0/1
No timer (loss not considered)
NACK‑free version, but no loss recovery; prepares for timer extension
rdt3.0
✅ Yes (checksum)
✅ Yes (handles loss)
ACK‑only, uses sequence numbers + countdown timer
✅ 0/1 seq numbers
✅ Timer per packet; timeout → retransmit
Handles both corruption AND packet loss; stop‑and‑wait inefficient
📌 Key insight: rdt2.x family solves bit errors and duplicates using sequence numbers, but assumes no loss. rdt3.0 adds a timer to detect lost packets (data or ACK) and retransmits → complete reliable data transfer over an unreliable channel. However, rdt3.0 is stop‑and‑wait → leads to pipelined protocols (GBN, SR, TCP).
rdt2.0: يكتشف الأخطاء (checksum) لكن لا يعالج الفقد، يستخدم ACK و NACK. rdt2.1: يضيف أرقام تسلسلية لتجنب التكرار، لا يزال بدون مؤقت. rdt2.2: مشابه لـ2.1 لكن بدون NACK (يعتمد على ACK المتأخر). rdt3.0: يضيف مؤقت (timer) لإعادة الإرسال عند فقدان الحزمة أو الـACK، يتعامل مع الفقد والفساد.
Client → ESTABLISHED; upon receipt, server → ESTABLISHED.
Data can be piggybacked on this ACK.
📡 VISUAL HANDSHAKE 🖥️ Client 🧩 Server |------ SYN (seq=x) ------------------->| |<---- SYN+ACK (seq=y, ack=x+1) ------| |------ ACK (seq=x+1, ack=y+1) ------->| ✅ ESTABLISHED ✅ ESTABLISHED
Why three ways? Prevents old duplicate connection initiations (synchronizes seq numbers, allocates buffers, avoids half‑open connections).
SYN flood attack: attacker sends many SYN without final ACK → consumes server resources.
After handshake, both sides can send data: full‑duplex reliable stream.
Three‑way handshake: 1) العميل يرسل SYN (seq=x). 2) الخادم يرد بـ SYN+ACK (seq=y, ack=x+1). 3) العميل يرسل ACK (ack=y+1). بعدها يتم الاتصال (ESTABLISHED). تضمن مزامنة الأرقام التسلسلية ومنع الاتصالات القديمة.
📖 page 5⚠️ Congestion Control · Causes & Approaches
10. Principles of Congestion Control
Congestion occurs when “too many sources sending too much data too fast for the network to handle” (differs from flow control).
🚦 Manifestations
Packet loss (router buffer overflow)
Long delays (queueing in buffers)
💸 Costs & Causes
Retransmissions increase load (λ*_in > λ_in)
Premature timeouts → duplicate copies
Multihop congestion: throughput collapses when rates increase
11. Approaches to Congestion Control
📡 End‑to‑End Congestion Control
No explicit network feedback
End systems infer congestion from loss/delay
Used by TCP (loss‑based, delay‑based variants)
🏷️ Network‑Assisted Congestion Control
Routers provide explicit feedback (e.g., ECN bit)
Explicit rate notification possible
Example: ECN, ATM, some data center protocols
Key distinction: Flow control = receiver capacity; Congestion control = network capacity.
ECN (Explicit Congestion Notification): network‑assisted congestion control. Router sets a bit in IP header → receiver echoes to sender → sender reduces rate.
الازدحام: إرسال بيانات أكثر من طاقة الشبكة → خسارة حزم وتأخير. التكلفة: إعادة الإرسال تزيد الحمل. نهجان: end‑to‑end (TCP يستدل من الفقد) و network‑assisted (الموجهات ترسل إشارة مثل ECN).
📌 Concept: Sender treats segment (header + data) as sequence of 16‑bit integers, computes ones' complement sum, places result in checksum field. Receiver recomputes and checks if result is all 1's (0xFFFF).
🔢 Example (simplified 16-bit words):
Suppose we have three 16-bit words: 1100 1010 0111 0001 (0xCA71) 1010 1010 0101 1111 (0xAA5F) 0111 0001 1100 1011 (0x71CB)
3. Receiver verification: Receiver computes sum of all words including checksum field (0x1963). Total sum = 0xE69C + 0x1963 = 0xFFFF → all bits 1 → no error detected.
⚠️ Note: matching checksum indicates no error detected, but cannot guarantee zero errors (limited detection).
Why ones' complement? Endian‑independent, easy to compute, detects all errors affecting an odd number of bits, and simple to implement in hardware.
UDP checksum: تجمع الكلمات 16-bit باستخدام الجمع مع wrap-around، ثم تأخذ ones' complement. المرسل يضع الناتج في حقل المجموع. المستقبل يعيد الحساب، إذا كانت النتيجة 0xFFFF فلا خطأ مكتشف. المثال: كلمات CA71 + AA5F + 71CB → المجموع E69C → مكمل واحد = 1963. عند التحقق E69C+1963=FFFF.
📌 Summaryrwnd · cwnd · key takeaways
Flow Control vs Congestion Control Recap
Flow Control (receiver window rwnd): prevents sender from overwhelming receiver buffer. Advertised via TCP header.
Congestion Control (cwnd): prevents sender from overloading network. Dynamically adjusted based on loss/delay.
TCP sender effective window = min(rwnd, cwnd).
TCP uses pipelined sliding window, cumulative ACK, fast retransmit, and SACK option for efficiency.
📌 Key takeaway: rdt3.0 solves loss & corruption → pipelining (GBN/SR) → TCP integrates flow, congestion, and reliability.
📘 Chapter 3 Complete — Merged Edition (PDF order + extended content): full original summary (pages 1–5) + RDT comparison table (rdt2.0,2.1,2.2,3.0), deep three‑way handshake, UDP checksum numeric example, GBN vs SR, flow/congestion control. All sections placed according to original PDF sequence.
🔁 Use toggle buttons for Arabic translation of each major section.