Transport Layer – TCP & UDP Comprehensive Notes
Transport Layer: Scope
Responsible for process-to-process (end-to-end) delivery of message segments.
Operates above the network layer (host-to-host delivery).
Protocols at the Transport Layer
Main TCP/IP protocols are:
TCP (Transmission Control Protocol): reliable, connection-oriented.
UDP (User Datagram Protocol): best-effort, connectionless.
TCP: Purpose & Philosophy
Defined in RFC 793.
Adds reliability and connection semantics to IP.
Guarantees in-order, lossless, non-duplicated, and uncorrupted byte stream delivery; informs sender if not.
Core TCP Facilities
Stream Data Transfer: Divides byte streams into segments, each byte numbered by a Sequence Number.
Full-Duplex Operation: Bidirectional simultaneously.
Multiplexing / Demultiplexing: Uses port numbers (16-bit) to identify processes. A full TCP connection is uniquely identified by .
Well-known ports: .
Logical Connections: Maintains state variables per stream.
Reliability: Uses Positive ACK with Retransmission (retransmits on timer timeout) and Cumulative ACK (ACK value = next expected byte).
Flow Control: Via Sliding Window, where the receiver advertises its window size (bytes it can accept).
TCP Segment Format
Header size: bytes ( bytes).
Key fields include Source/Destination Port, Sequence Number, Acknowledgment Number, Flags (URG, ACK, PSH, RST, SYN, FIN, CWR, ECE), Window, Checksum, Urgent Pointer.
TCP Connection Management
Establishment: Three-way handshake (SYN, SYN+ACK, ACK).
Termination: Four-step process (FIN, ACK, FIN, ACK).
UDP: Characteristics
Defined in RFC 768.
Connection-less, unreliable, no handshake, minimal 8-byte header.
Suitable for real-time applications (VoIP, streaming) where retransmission is counterproductive.
UDP Datagram Format
Header: Source Port, Destination Port, Length, Checksum.
Maximum payload: bytes.
Comparative Summary: TCP vs UDP
Feature | TCP | UDP |
|---|---|---|
Connection | Connection-oriented | Connection-less |
Reliability | Yes | No |
Flow Control | Sliding window | None |
Congestion Control | Yes | None |
Header Size | 20-60 bytes | 8 bytes |
Typical Apps | HTTP, FTP, SMTP, TELNET | VoIP, DNS, DHCP, streaming |
Ethical & Practical Considerations
Protocol choice impacts network load.
Security: Open ports require firewalling.
Key Numbers
Port range: . Max UDP data: bytes. TCP header: bytes.