Detailed Guide on TCP Model and UDP
Transport Protocols: TCP and UDP
The transport layer in the OSI and TCP/IP models ensures end-to-end
communication between applications running on different hosts. Two widely
used transport layer protocols are:
TCP (Transmission Control Protocol): Reliable and connection-
oriented protocol used for critical applications.
UDP (User Datagram Protocol): Lightweight and connectionless
protocol used for applications that prioritize speed over reliability.
1. Elements of Transport Protocols
a. Addressing
The transport layer uses IP addresses and port numbers to identify
endpoints for communication.
o Example: A web server may use IP 192.168.1.1 with port 80 to
receive HTTP requests.
o Each application is assigned a unique port number (e.g., HTTP:
80, HTTPS: 443).
b. Connection Establishment and Release
TCP Connection Establishment: A three-way handshake process:
o The client sends a SYN (synchronize) packet to the server.
o The server responds with a SYN-ACK (synchronize +
acknowledge) packet.
o The client replies with an ACK (acknowledge) packet, completing
the handshake.
Example:
o A client initiates communication with a web server to download a
webpage.
TCP Connection Release: A four-step process where both ends agree
to terminate the connection using FIN (finish) and ACK flags.
c. Flow Control and Buffering
Prevents the sender from overwhelming the receiver.
Sliding Window Protocol:
o Sender transmits a set number of packets (window size) and
waits for acknowledgments.
o Example: If a receiver’s buffer size is 5 packets, the sender sends
5 packets and pauses until acknowledgment.
d. Multiplexing and Demultiplexing
Multiplexing: Allows multiple applications to use the same network
link.
Demultiplexing: Ensures the received data is delivered to the correct
application using port numbers.
o Example: A device can simultaneously run a web browser (port
80) and an email client (port 25).
e. Crash Recovery
Ensures communication can resume after interruptions.
o TCP uses sequence numbers and acknowledgments to track
data.
o If a crash occurs, data can be retransmitted based on
unacknowledged sequence numbers.
f. Introduction to UDP Protocol
UDP is a simple protocol without connection setup or guarantees for
delivery.
o Example Use Case: Online video streaming, where missing some
packets is acceptable to maintain real-time playback.
2. Principles of Reliable Data Transfer
a. Reliable Data Transfer Over a Perfectly Reliable Channel
Assumes no errors or losses in transmission.
Protocols ensure delivery confirmation through acknowledgment
messages.
o Example: A sender waits for an acknowledgment before sending
the next packet.
b. Channel with Bit Errors
Errors can occur during transmission.
o Error Detection: Checksums and cyclic redundancy checks
(CRC) are used to detect data corruption.
o ARQ (Automatic Repeat reQuest): Retransmission of
corrupted or unacknowledged packets.
ARQ Variants:
o Stop-and-Wait ARQ: Sends one packet at a time and waits for
acknowledgment.
o Go-Back-N ARQ: Sends multiple packets but retransmits all
packets after a loss.
o Selective Repeat ARQ: Retransmits only corrupted packets,
increasing efficiency.
c. Lossy Channel with Bit Errors
Packets may be lost entirely in addition to being corrupted.
o Timeout Mechanism: Retransmits packets if acknowledgment
is not received within a set time.
o Example: A server resends a lost packet after detecting no
response from the client.
3. Transport Layer in the Internet
a. Introduction to TCP
TCP provides reliable, ordered delivery of data with error detection.
o Example: Downloading a file via HTTP ensures the file is received
intact.
b. TCP Service Model
Stream-Oriented Communication: Treats data as a continuous
stream of bytes.
Key Features:
o Reliable Delivery: Uses sequence numbers and
acknowledgments.
o Error Detection: Employs checksums.
o Flow Control: Adjusts data flow based on receiver’s capacity.
c. TCP Header and Segment Structure
TCP Header Fields:
o Source and Destination Port: Identifies the applications.
o Sequence Number: Tracks data order.
o Acknowledgment Number: Indicates received data.
o Flags: Control signals (e.g., SYN, ACK, FIN).
o Window Size: Helps manage flow control.
o Checksum: Detects errors.
d. TCP Connection Establishment and Release
See the Connection Establishment and Release section above for
details.
e. Transmission Policy
Ensures efficient data transfer:
o Retransmits lost or corrupted data.
o Uses cumulative acknowledgments for confirmed data.
f. Timer Management
Retransmission Timer: Retransmits data if acknowledgment isn’t
received.
Round-Trip Time (RTT) Estimation: Dynamically adjusts timeout
based on measured RTT.
g. Transactional TCP (T/TCP)
Optimized for short, quick transactions, reducing the overhead of
connection setup.
o Example: DNS lookups or lightweight API calls.
4. Mobile TCP
TCP adapted for mobile environments with unique challenges such as:
o High Latency: Delay in communication.
o Variable Bandwidth: Network speed fluctuates.
o Frequent Disconnections: Mobile devices often lose
connectivity.
Key Features:
Freeze Mode: Pauses communication when a device disconnects and
resumes when reconnected.
Low Overhead: Reduces the number of control packets to conserve
bandwidth.
5. TCP Congestion Control
a. Fairness
Ensures equitable bandwidth allocation among users.
o Example: If two users are downloading files, they should share
the network equally.
b. TCP Delay Modeling
Models the delay caused by:
o Retransmissions: Due to packet loss or errors.
o Queueing: Packets waiting in router buffers.
c. Congestion Control Mechanisms
Slow Start:
o Starts with a small data rate and increases exponentially until
congestion is detected.
Congestion Avoidance:
o Maintains a steady data rate to prevent overwhelming the
network.
Fast Retransmit:
o Quickly resends data upon receiving duplicate acknowledgments,
indicating packet loss.
Fast Recovery:
o Reduces the transmission rate less aggressively to recover
quickly from packet loss.
Examples
TCP: Used for reliable applications such as file transfers (HTTP, FTP)
and emails (SMTP).
UDP: Used for speed-critical applications such as video streaming,
online gaming, and DNS lookups.
By understanding these elements, we gain insight into how modern
communication systems handle reliability, efficiency, and adaptability across
diverse networks.