Module 3- Transport layer(process-to-process)
1. Introduction to the Transport Layer
The Transport Layer is the fourth layer of the TCP/IP protocol stack (and the fifth in the OSI
model).
It provides logical communication between application processes running on different
hosts.
Definition:
The Transport Layer is responsible for delivering data from one process to another, ensuring
reliability, correct sequencing, and error recovery — independent of the underlying physical
network.
Key Functions of the Transport Layer
Function Description
Segmentation & Breaks large application messages into smaller segments,
Reassembly reassembles at receiver.
Establishes, maintains, and terminates connections between
Connection Control
processes.
Flow Control Prevents sender from overwhelming receiver.
Ensures reliable delivery using ACKs, checksums, and
Error Control
retransmission.
Multiplexing &
Allows multiple applications to use network simultaneously.
Demultiplexing
Congestion Control Manages traffic to avoid overload in the network.
End-to-End Communication
Layer Communication Type
Network Layer Host-to-Host (logical connection between devices)
Transport Layer Process-to-Process (logical connection between applications)
Example:
When you visit [Link],
• Network layer connects your laptop ↔ Google server.
• Transport layer connects your browser process ↔ Gmail’s web server process.
2.
Aspect Network Layer (IP) Transport Layer (TCP/UDP)
Service
Host-to-Host delivery Process-to-Process delivery
Provided
Protocol Type IP (Unreliable, best-effort) TCP (Reliable), UDP (Unreliable)
Limited (header checksum
Error Handling Extensive (ACKs, retransmissions)
only)
Connection Connection-oriented (TCP) / Connectionless
Connectionless
Type (UDP)
Data Unit Packet (datagram) Segment
3. Transport Layer Protocols in the Internet
Protocol Full Form Type Reliability Used For
Transmission Control Connection- Web (HTTP), Email (SMTP),
TCP Reliable
Protocol oriented File Transfer (FTP)
User Datagram
UDP Connectionless Unreliable Streaming, DNS, VoIP, Games
Protocol
TCP (Transmission Control Protocol)
• Provides reliable, ordered, congestion-controlled delivery of data.
• Connection established before transfer (3-way handshake).
• Guarantees in-order and complete delivery.
UDP (User Datagram Protocol)
• Lightweight and faster (no connection establishment).
• No guarantee of reliability or order.
• Used where speed > accuracy (real-time apps).
4. Multiplexing and Demultiplexing (Overview)
When many applications share the same network, the transport layer identifies which data
belongs to which process.
Multiplexing:
Collecting data from multiple applications and sending them into the network using sockets.
Demultiplexing:
Delivering received data to the correct application based on port numbers.
Example:
• Browser uses port 80 for HTTP,
• Mail app uses port 25 for SMTP,
• All share the same IP address, but different port numbers distinguish them
[Link] and Demultiplexing
Introduction
In a computer network, many applications (like your web browser, email client, and music
app) run simultaneously and send data over the same network connection.
So, the Transport Layer must decide which segment belongs to which application — this is
done through Multiplexing and Demultiplexing.
Definition:
Multiplexing and Demultiplexing are processes that enable multiple application processes
to share the same network connection efficiently.
The Concept of Multiplexing
Multiplexing = Combining
It is the process by which data from multiple applications is collected and combined at the
sender’s transport layer, then passed to the network layer for transmission.
Example:
Your laptop runs:
• a web browser (HTTP request on port 80),
• an email client (SMTP on port 25),
• a music app (Spotify using a custom port).
All three send data simultaneously, and the Transport Layer multiplexes these streams into
one outgoing channel (IP address).
How It Works (Sender Side):
Each application passes data to the Transport Layer via a socket.
The transport layer adds a header with identifying information (source port, destination
port, etc.).
All segments are combined and sent over the same IP address using the Network Layer.
The Concept of Demultiplexing
Demultiplexing = Separating
It is the process of delivering received transport-layer segments to the correct receiving
process based on their port numbers.
Example:
A packet arrives at your computer’s IP address:
• Destination port 80 → goes to browser (HTTP)
• Destination port 25 → goes to mail app (SMTP)
• Destination port 53 → goes to DNS resolver
The Transport Layer demultiplexes each segment to the right socket.
How It Works (Receiver Side):
The Network Layer delivers incoming segments to the Transport Layer.
Each segment contains:
• Source IP, Source Port
• Destination IP, Destination Port
The Transport Layer uses the Destination Port Number to identify the correct
socket.
Segment is then delivered to the corresponding application process.
Multiplexing & Demultiplexing in UDP and TCP
Although both TCP and UDP perform these functions, they do so differently.
A. UDP Multiplexing/Demultiplexing
UDP is connectionless → no handshakes or sessions.
Each incoming UDP segment is directed to the socket using:
(Destination IP, Destination Port)
Two different UDP segments with the same port but different source addresses are
considered different conversations.
B. TCP Multiplexing/Demultiplexing
TCP is connection-oriented → it identifies each connection uniquely using:
(Source IP, Source Port, Destination IP, Destination Port)
This allows multiple simultaneous TCP connections to the same server.
Example: You can open multiple browser tabs to [Link] — each one uses a
unique client port.
Comparison: UDP vs TCP Multiplexing
Aspect UDP TCP
Connection Type Connectionless Connection-oriented
Socket Identifier (Dest IP, Dest Port) (Src IP, Src Port, Dest IP, Dest Port)
Multiple Connections Allowed No Yes
Overhead Low High
Use Cases DNS, Streaming HTTP, FTP, SMTP
Diagram
At Sender (Multiplexing):
App1 → Port 80 → Segment → ↓
App2 → Port 25 → Segment → ↓
Transport Layer → Network Layer (IP)
At Receiver (Demultiplexing):
Network Layer → Segment
If Port 80 → Deliver to App1 (HTTP)
If Port 25 → Deliver to App2 (Mail)
Example: Web Browsing and Email Together
When you open Gmail in a browser:
• Browser (client): assigns random source port, sends data to server port 80 (HTTP).
• Email app (client): uses source port 25, connects to SMTP server.
At the receiver:
• TCP connection for HTTP → browser socket.
• TCP connection for SMTP → mail socket.
Both use the same IP address, but different port numbers keep them separate.
3. Connectionless Transport: UDP (User Datagram Protocol)
Definition:
UDP is a connectionless, unreliable transport-layer protocol that delivers application
messages as independent datagrams without guaranteeing reliability, ordering, or
congestion control.
Analogy:
Think of UDP like postal postcards — you drop them in the mailbox and hope they arrive.
No delivery confirmation, no tracking, but very fast and simple.
Features of UDP:
Feature Description
Connectionless No setup before sending data. Each packet is independent.
Unreliable No guarantee of delivery, order, or duplication protection.
No Congestion Control Can send data freely — even if network is congested.
Checksum Support Detects bit-level errors.
Fast and Lightweight Only 8-byte header — minimal overhead.
Application Control Lets the application decide how to handle loss/delay.
Common Applications of UDP:
Application Why UDP?
DNS (Domain Name System) Simple query–response, small messages.
VoIP / Video Streaming Speed > Reliability; minor losses acceptable.
Online Gaming Low latency is critical.
SNMP (Network Management) Quick communication between routers.
DHCP (Address Assignment) Simple request–reply exchanges.
UDP Working Principle
Application sends data to UDP.
UDP adds a header (source port, destination port, checksum, length).
UDP segment is passed to IP for delivery.
IP layer may lose, duplicate, or reorder packets — UDP does not correct this.
Receiver’s UDP verifies checksum, strips header, and gives data to the correct
application.
Sender Application → UDP → IP → Receiver UDP → Application
UDP Segment Structure
0-------------------------31
+--------+--------+--------+--------+
| Source Port | Destination Port |
+--------+--------+--------+--------+
| Length | Checksum |
+--------+--------+--------+--------+
| Data ... |
+------------------------------------+
Field Size (bits) Description
Source Port 16 Identifies the sending process.
Destination Port 16 Identifies the receiving process.
Length 16 Total length (header + data).
Checksum 16 Detects bit errors in segment.
UDP Checksum:
To detect errors in transmitted segments (bit flips, corruption).
Working:
Sender performs 1’s complement addition of all 16-bit words in header + data.
Then takes 1’s complement of the result → checksum value.
Receiver performs the same sum:
• If result = all 1s → no error.
• Otherwise → packet corrupted (discarded).
+------------------------------------------+
| Application Layer |
| (e.g., DNS, VoIP, Streaming App |
+------------------↑-----------------------+
| Data
↓
+------------------------------------------+
| UDP (Transport Layer) |
| Add Port #, Length, Checksum |
+------------------↓-----------------------+
| Segment
↓
+------------------------------------------+
| IP (Network Layer) |
| Adds IP Header (src & dest addresses) |
+------------------------------------------+