End-to-End Protocols — Deep Dive
End-to-end protocols manage communication between two hosts across a network. They ensure
data is delivered correctly, reliably, and in order, regardless of the underlying infrastructure.
🔹 1. Simple Demultiplexer (UDP)
📌 What is UDP?
User Datagram Protocol (UDP) is a connectionless, lightweight protocol.
It provides minimal services: no reliability, no ordering, no congestion control.
🧠 Key Features
Demultiplexing: Uses port numbers to deliver data to the correct application.
No handshake: Data is sent without establishing a connection.
Low overhead: Ideal for real-time applications (e.g., video streaming, DNS).
⚠️Limitations
No guarantee of delivery.
No retransmission or error correction.
Applications must handle reliability if needed.
🔹 2. Reliable Byte Stream (TCP)
📌 What is TCP?
Transmission Control Protocol (TCP) provides a reliable, ordered, and error-
checked delivery of a stream of bytes.
It’s connection-oriented and ensures end-to-end reliability.
🧠 Key Features
Byte stream abstraction: Data is treated as a continuous stream.
Reliable delivery: Lost packets are retransmitted.
In-order delivery: Packets are reassembled in the correct order.
Flow and congestion control: Prevents overwhelming the receiver or network.
🔹 3. End-to-End Issues
These are challenges that arise in maintaining reliable communication across a network:
Packet loss: Data may be dropped due to congestion or errors.
Out-of-order delivery: Packets may arrive in a different sequence.
Duplicate packets: Retransmissions can cause duplicates.
Delay and jitter: Variable transmission times affect performance.
Congestion: Too much traffic can slow down or disrupt communication.
TCP addresses these issues using mechanisms like acknowledgments, timeouts, and
windowing.
🔹 4. Segment Format
📦 TCP Segment Structure
A TCP segment includes:
Field Purpose
Source Port Identifies sending application
Destination Port Identifies receiving application
Sequence Number Position of data in byte stream
Acknowledgment Number Confirms receipt of data
Flags (SYN, ACK, FIN, etc.) Control connection state
Window Size Flow control
Checksum Error detection
Urgent Pointer Marks urgent data
Options Extensions (e.g., timestamps)
🔹 5. Connection Establishment and Termination
🔄 TCP Three-Way Handshake
1. SYN: Client sends SYN to initiate connection.
2. SYN-ACK: Server responds with SYN-ACK.
3. ACK: Client sends ACK to confirm.
Connection is now established.
🛑 Connection Termination
Uses FIN and ACK flags.
Ensures both sides agree to close the connection gracefully.
🔹 6. Sliding Window Revisited
📌 Purpose
Controls how much data can be sent before waiting for acknowledgment.
Enables efficient use of bandwidth and flow control.
🧠 Mechanism
Sender maintains a window of unacknowledged data.
Receiver advertises its buffer size (window size).
Window slides forward as ACKs are received.
🔹 7. Triggering Transmission
TCP decides when to send data based on:
Application requests
Window availability
Timeouts
ACKs received
Efficient triggering avoids unnecessary delays and maximizes throughput.
🔹 8. Adaptive Retransmission
📌 Goal
Dynamically adjust retransmission timeout (RTO) based on network conditions.
🧠 How It Works
TCP measures Round-Trip Time (RTT).
Uses algorithms (e.g., Jacobson/Karels) to estimate RTO:
o RTO = Estimated RTT + 4 × RTT variance
Adapts to changing delays and avoids premature retransmissions.
🔹 9. Record Boundaries
📌 Issue
TCP treats data as a stream, not discrete messages.
Applications must define record boundaries (e.g., using delimiters or length fields).
🧪 Example
HTTP uses headers to indicate content length.
FTP uses control messages to separate files.
🔹 10. TCP Extensions
TCP has evolved with several enhancements:
Extension Purpose
TCP Timestamps Improves RTT estimation and performance
Selective Acknowledgment (SACK) Acknowledges non-contiguous blocks
Window Scaling Supports large windows for high-speed links
Fast Retransmit & Recovery Speeds up recovery from packet loss
🧠 Summary
Protocol Reliability Connection Use Case
UDP No No Real-time, low-latency apps
TCP Yes Yes Web, email, file transfer
TCP handles complex end-to-end issues using mechanisms like sliding windows, adaptive
retransmission, and extensions to ensure robust communication.
Queuing Disciplines
Queuing disciplines determine how packets are managed and scheduled when they arrive at a
router or switch. They affect fairness, latency, and throughput.
🔹 1. FIFO (First-In, First-Out)
📌 Concept
The simplest queuing discipline.
Packets are processed in the order they arrive.
No prioritization or differentiation.
⚠️Limitations
Can lead to unfair bandwidth usage.
High-bandwidth flows can dominate the queue.
No protection for delay-sensitive traffic (e.g., VoIP).
🔹 2. Fair Queuing (FQ)
📌 Concept
Aims to allocate bandwidth fairly among multiple flows.
Each flow gets its own virtual queue.
Packets are scheduled based on finish time in a round-robin fashion.
🧠 How It Works
Simulates a bit-by-bit round-robin across flows.
Ensures no single flow monopolizes the link.
Can be extended to Weighted Fair Queuing (WFQ) for priority-based scheduling.
✅ Benefits
Prevents starvation.
Supports QoS (Quality of Service).
Ideal for mixed traffic environments.
🌐 TCP Congestion Control
TCP uses adaptive algorithms to manage congestion and ensure reliable delivery. These
mechanisms help maintain network stability and fairness.
🔹 3. Additive Increase / Multiplicative Decrease (AIMD)
📌 Concept
Core principle behind TCP congestion control.
Balances aggressiveness and responsiveness.
🧠 How It Works
Additive Increase: Gradually increases congestion window (CWND) by 1 MSS
(Maximum Segment Size) per RTT.
Multiplicative Decrease: Halves CWND when packet loss is detected.
🎯 Goal
Probe for available bandwidth.
Back off quickly when congestion occurs.
🔹 4. Slow Start
📌 Purpose
Used during connection startup or after a timeout.
Avoids overwhelming the network initially.
🧠 How It Works
CWND starts at 1 MSS.
Doubles every RTT (exponential growth).
Continues until reaching slow start threshold (ssthresh) or packet loss.
⚠️Risk
Can cause burst congestion if threshold is too high.
🔹 5. Fast Retransmit
📌 Trigger
Activated when three duplicate ACKs are received.
Indicates likely packet loss without waiting for timeout.
🧠 Action
Retransmits the missing segment immediately.
Speeds up recovery compared to waiting for RTO (Retransmission Timeout).
🔹 6. Fast Recovery
📌 Purpose
Avoids returning to slow start after fast retransmit.
Maintains higher throughput during recovery.
🧠 How It Works
After fast retransmit:
o CWND is reduced (multiplicative decrease).
o Enters congestion avoidance mode.
o Continues with linear growth instead of exponential.
🧠 Summary Table
Mechanism Purpose Behavior
FIFO Simple queuing First come, first served
Fair Queuing Fair bandwidth allocation Round-robin across flows
AIMD Congestion control Additive growth, multiplicative backoff
Slow Start Safe startup Exponential CWND growth
Fast Retransmit Quick loss recovery Retransmit after 3 duplicate ACKs
Fast Recovery Efficient post-loss recovery Avoids slow start, linear growth