Transport Layer: UDP vs. TCP
The Transport Layer provides process-to-process communication, with UDP offering connectionless, unreliable service and TCP providing connection-oriented, reliable service.
Core Principles
- Transport layer protocols enable communication between application processes on different hosts.
- Sender breaks application messages into segments; receiver reassembles segments.
- Multiplexing and demultiplexing allow multiple application processes to share a single network connection.
- UDP is connectionless and unreliable, suitable for applications tolerant of packet loss.
- TCP is connection-oriented and reliable, providing in-order delivery, flow control, and congestion control.
- Demultiplexing uses port numbers (UDP) or a 4-tuple (TCP) to direct segments to the correct application process.
- Reliable data transfer protocols manage packet loss and reordering through mechanisms like acknowledgments and retransmissions.
- Flow control prevents a sender from overwhelming a receiver's buffer.
- Congestion control aims to prevent network collapse by managing the rate of data injection into the network.
- TCP connection management involves a three-way handshake for setup and a termination process.
Key Terms
- Transport Layer: Provides process-to-process communication services.
- UDP: User Datagram Protocol; connectionless, unreliable, best-effort service.
- TCP: Transmission Control Protocol; connection-oriented, reliable, in-order byte stream service.
- Multiplexing: Handling data from multiple sockets and adding transport headers at the sender.
- Demultiplexing: Using header information to deliver received segments to the correct socket at the receiver.
- Socket: The programming interface (door) between an application process and the end-to-end transport protocol.
- Port Number: Identifies a specific process or service on a host, used by UDP for demultiplexing.
- 4-tuple: Source IP address, Source Port, Destination IP address, Destination Port; used by TCP for demultiplexing.
- Reliable Data Transfer: Mechanisms to ensure data arrives correctly and in order, despite network errors.
- Flow Control: Receiver manages sender's rate to prevent buffer overflow.
- Congestion Control: Mechanisms to manage network congestion by adjusting sending rates.
- RTT: Round-Trip Time; the time taken for a segment to travel from sender to receiver and back.
- Timeout Interval: Estimated RTT plus a safety margin, used to detect packet loss.
- AIMD: Additive Increase, Multiplicative Decrease; a common TCP congestion control strategy.
- Slow Start: TCP phase where the congestion window increases exponentially.
- Congestion Avoidance: TCP phase where the congestion window increases linearly.
- Fast Retransmit: Resending a segment upon receiving multiple duplicate ACKs, without waiting for a timeout.
- Pipelining: Allowing multiple packets to be in flight (unacknowledged) simultaneously to improve throughput.
Real World Examples
- Web browsing: HTTP requests are typically sent over TCP for reliable delivery of web pages and their components.
- Online gaming: UDP is often preferred for real-time games due to its lower latency, even if some packet loss occurs.
- Video streaming: Streaming services often use UDP or adaptive protocols like DASH over HTTP, balancing reliability with the need for continuous playback.
- DNS queries: DNS typically uses UDP for quick, simple name resolution, as reliability is handled by the application layer if needed.
- File transfer (FTP): FTP relies on TCP to ensure all parts of the file are transferred reliably and in order.
- Real-time voice communication (VoIP): VoIP often uses UDP for low-latency communication, with application-level mechanisms for error handling.
Timeline
- 1980s: Development and standardization of TCP/IP protocols.
- 1989: Introduction of UDP as a simpler, faster alternative to TCP for certain applications.
- 1990s: Widespread adoption of TCP/IP, leading to the modern Internet.
- Late 1990s - Early 2000s: Development of congestion control algorithms like TCP Reno and TCP Tahoe.
- 2000s: Emergence of adaptive streaming protocols and increased focus on performance for multimedia.
- 2010s: Development of QUIC protocol, building on UDP to improve performance and reduce latency.
More like this