0% found this document useful (0 votes)
4 views31 pages

Understanding Transport Layer Protocols

Unit 3 notes

Uploaded by

ombadwaik92
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views31 pages

Understanding Transport Layer Protocols

Unit 3 notes

Uploaded by

ombadwaik92
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Unit – III: Transport Layer

Protocols

What is Transport Layer


The Transport Layer is one of the layers in the OSI (Open Systems
Interconnection) model of networking. It is the 4th layer, and its main job is
to deliver data from one computer to another accurately and in the right
order.

1. Process-to-Process Delivery (in Transport Layer)


What it means:
• The Transport Layer provides Process-to-Process Delivery.
• This means it delivers data from one specific program (process) on the
sending computer to the correct program (process) on the receiving
computer.

Explanation
• The Network Layer provides host-to-host delivery.
It sends data from one computer to another computer across the
network.
• But on each computer, there are many applications (processes) running
at the same time — for example, a browser, an email app, and a music
player.
• The Transport Layer takes care of which application (process) should
receive the incoming data.
This is called Process-to-Process Delivery.
Port Numbers
To identify each process uniquely, the transport layer uses port numbers.
Each application running on a computer is assigned a port number.
For example:
Application Protocol Port Number

Web (HTTP) TCP 80

Email (SMTP) TCP 25

DNS UDP 53

File Transfer (FTP) TCP 21


Client–Server Paradigm

Introduction

The Client–Server Paradigm is a network model used for communication


between two processes — one acting as a client and the other as a server.
It is widely used in computer networks, especially in the Transport Layer and
Application Layer.

Meaning

• The Client is a process that requests a service or resource.


• The Server is a process that provides the requested service or resource.
Thus, communication happens as Client → Server → Client.

How It Works

1. The server is always ready, waiting to provide a service (like hosting a


website or handling emails).
2. The client sends a request for that service.
3. The server processes the request and sends back a response.
This is known as the Client–Server interaction.

Example

Client Server Function

Web Browser Web Server Browser requests a web page → Server sends page

Email Client Mail Server Client sends/receives emails

Example in sentence:
A browser (client) requests a webpage from a web server (server). The
server sends the page back to the browser.
Multiplexing and Demultiplexing – Transport Layer

Introduction
In computer networks, many applications (processes) can run at the same time
on one device — for example, a web browser, an email app, and a music player.
The Transport Layer handles this using Multiplexing and Demultiplexing.
These two functions help send and receive data correctly between multiple
processes.

1. Multiplexing (at the Sender Side)


Meaning:
Multiplexing means combining data from multiple processes and sending them
together over a single network channel.
In simple words:
It allows data from many applications to share the same transport
connection.
How it works:
• Each application (process) passes data to the Transport Layer.
• The Transport Layer adds a header with a port number to identify which
process the data belongs to.
• All these data segments are combined and sent to the Network Layer as
one stream.
Example:
Your computer runs:
• Browser (port 80)
• Email app (port 25)
• Music app (port 443)
The Transport Layer multiplexes data from all these processes and sends
it through the same network connection.
2. Demultiplexing (at the Receiver Side)
Meaning:
Demultiplexing is the reverse process of multiplexing.
It means receiving data from the network and delivering it to the correct
process based on the port number.
How it works:
• The Transport Layer at the receiver gets data segments from the
Network Layer.
• It checks the destination port number in each segment.
• Then it delivers the segment to the correct application (process).
Example:
If data arrives with:
• Port 80 → goes to Web Browser
• Port 25 → goes to Email App
• Port 443 → goes to Music App
The Transport Layer demultiplexes and sends each one to the right program.

Role of Port Numbers

Port numbers are essential for both multiplexing and demultiplexing.

Type Description Example

Browser (port
Source Port Number Identifies the sending process
49152)

Destination Port Identifies the receiving


Web Server (port 80)
Number process
Connection-Oriented vs Connectionless Services

Introduction

The Transport Layer provides two types of communication services between


processes:
1. Connection-Oriented Service
2. Connectionless Service
These define how data is sent and received between sender and receiver.

Connection-Oriented Service

Meaning:
Before data is sent, a connection is established between sender and receiver
— like making a phone call before talking.

Process Steps:

1. Connection Establishment – Handshake between sender & receiver.


2. Data Transfer – Data sent in proper sequence.
3. Connection Termination – Connection closed after communication.

Example:
TCP (Transmission Control Protocol) — used in web browsing, emails, file
transfer.

Characteristics:

• Reliable delivery (data reaches correctly).


• Data is sent in sequence.
• Acknowledgement and error control are used.
• Slower but more secure and accurate.

Example:
When you make a phone call — you first connect, then talk, then disconnect.
Connectionless Service

Meaning:
Data is sent without establishing any connection — like sending a letter
without calling first.

Process Steps:

• Each packet of data is sent independently.


• The receiver doesn’t confirm delivery.
• Packets may arrive out of order or get lost.

Example:
UDP (User Datagram Protocol) — used in online games, video calls, live
streaming.

Characteristics:

• No connection setup.
• No acknowledgement.
• Fast but unreliable.
• Each packet (datagram) is treated separately.

Example:
Sending a message by post — you just drop it, and hope it reaches the
destination.

Comparison Table

Feature Connection-Oriented Connectionless

Connection Setup Required (before data transfer) Not required

Protocol Example TCP UDP


Feature Connection-Oriented Connectionless

Reliability Reliable Unreliable

Acknowledgement Yes No

Order of Delivery In sequence May be out of order

Speed Slower Faster

Overhead More (due to setup) Less

Example Web browsing, email Live video, online gaming


User Datagram Protocol (UDP)

Introduction

UDP (User Datagram Protocol) is a connectionless transport layer protocol.


It is used when speed is more important than reliability — that is, when we
can tolerate some data loss but need fast communication.

Meaning

• UDP sends data without establishing a connection between sender and


receiver.
• It does not guarantee that data will reach safely or in order.
• It is also called a “best-effort” delivery service.

Main Characteristics of UDP

1. Connectionless Service:
No connection setup before sending data.
Each message is independent (called a datagram).
2. Unreliable Delivery:
No acknowledgement — packets may be lost or arrive in the wrong
order.
3. Fast Transmission:
No extra overhead (no handshaking or error checking), so it’s very fast.
4. No Flow or Error Control:
UDP does not check for errors or control the speed of data flow.
5. Port Numbers Used:
Uses source and destination port numbers to identify processes.
Structure of UDP Segment (Header Format)

Field Size Description

Source Port 16 bits Identifies sending process

Destination Port 16 bits Identifies receiving process

Length 16 bits Total length of UDP header + data

Checksum 16 bits Used for error detection (optional)

Total UDP header size = 8 bytes (64 bits)

Working Example

Let’s say you’re watching a live cricket match online


• The streaming app sends video data continuously using UDP.
• Even if one or two packets are lost, the video continues smoothly (no
delay).
• That’s why UDP is fast but not reliable.

Applications / Uses of UDP

Port
Application Description
Number

Translates website names to IP


DNS (Domain Name System) 53
addresses

DHCP (Dynamic Host Assigns IP addresses


67/68
Configuration Protocol) automatically

TFTP (Trivial File Transfer


69 Simple file transfer
Protocol)
Port
Application Description
Number

Online Games / Streaming / VoIP – Fast data transfer

Advantages

Fast and efficient for real-time applications


Low delay (latency)
Simple and lightweight protocol

Disadvantages

No guarantee of delivery
No sequencing (packets may arrive out of order)
No flow or congestion control
Transmission Control Protocol (TCP)

Introduction

TCP (Transmission Control Protocol) is a connection-oriented transport layer


protocol.
It is used when reliable and ordered delivery of data is required — for
example, in web browsing, emails, and file transfer.

Meaning
• TCP establishes a connection between sender and receiver before
sending data.
• It ensures that all data reaches correctly, in order, and without
duplication.
• TCP provides a full-duplex communication, meaning both sender and
receiver can send data simultaneously.

Main Characteristics of TCP


1. Connection-Oriented:
o A connection is first established using a handshake before data
transfer.
2. Reliable Delivery:
o Ensures all data reaches the destination without errors.
o Uses acknowledgements (ACK) and retransmission if packets are
lost.
3. Ordered Delivery:
o Data segments are numbered, so the receiver can reassemble
them in the correct order.
4. Flow Control:
o TCP uses sliding window mechanism to avoid overwhelming the
receiver.
5. Error Detection and Correction:
o Uses checksum and retransmission to correct errors.
6. Full-Duplex Communication:
o Data can flow in both directions simultaneously.

Structure of TCP Segment (Header Format)

Field Size Description

Source Port 16 bits Sending process port

Destination Port 16 bits Receiving process port

Sequence Number 32 bits Order of data bytes

Acknowledgement Number 32 bits Confirms received data

Data Offset 4 bits TCP header size

Flags (Control Bits) 6 bits e.g., SYN, ACK, FIN for connection control

Window 16 bits Flow control size

Checksum 16 bits Error detection

Urgent Pointer 16 bits Points to urgent data

Options Variable Optional features

TCP header size = 20–60 bytes

Working Example (3-Way Handshake)


1. SYN: Client requests connection → Server
2. SYN-ACK: Server acknowledges request → Client
3. ACK: Client confirms → Connection established
Data Transfer: After handshake, data flows reliably.
Connection Termination: FIN + ACK messages close the connection.

Applications / Uses of TCP

Application Port Number Description

Web browsing (HTTP/HTTPS) 80 / 443 Reliable delivery of web pages

Email (SMTP, POP3, IMAP) 25 / 110 / 143 Sending and receiving emails

File Transfer (FTP) 21 Uploading and downloading files

Remote login (Telnet, SSH) 23 / 22 Secure remote access

Advantages

Reliable delivery of data


Ordered data transmission
Error detection and correction
Flow control to prevent congestion
TCP Segment

Introduction

A TCP segment is the unit of data used by the Transmission Control


Protocol (TCP) at the Transport Layer.
TCP breaks large data from the application layer into segments before
sending them to the network layer.

Structure of a TCP Segment

A TCP segment consists of Header + Data:

TCP Segment = TCP Header + Data

Important Control Flags

Flag Meaning

SYN Synchronize sequence numbers (start connection)

ACK Acknowledgement

FIN Finish – terminate connection

RST Reset – abort connection

PSH Push – deliver data immediately

URG Urgent – urgent data pointer valid


Working Example

1. A web browser wants to send data to a server:

o TCP divides data into segments.

o Adds header with source/destination ports, sequence


number, etc.

o Sends segments to IP layer for delivery.

2. Receiver:

o Checks checksum for errors.

o Uses sequence numbers to reassemble data in order.

o Sends ACK to sender for reliable delivery.

Key Points

• Each segment ensures reliable, ordered, and error-checked


delivery.

• Sequence and acknowledgement numbers help in retransmission if


data is lost.

• Header flags control connection setup and termination.

TCP Three-Way Handshake

Introduction

The Three-Way Handshake is the process used by TCP to establish a


reliable connection between a client and a server before data transfer.
It ensures that both sides are ready and agree on initial sequence
numbers for communication.
Steps of Three-Way Handshake

Step 1: SYN (Synchronize)

• The client wants to start a connection.

• It sends a SYN segment to the server with an initial sequence


number (ISN).

• Purpose: Request to establish a connection.

Client → Server : SYN (Seq = x)

Step 2: SYN-ACK (Synchronize-Acknowledge)

• The server receives the SYN.

• It acknowledges the client’s request by sending an ACK.

• It also sends its own SYN with its sequence number.

Server → Client : SYN-ACK (Seq = y, Ack = x+1)

• Purpose: Confirm client’s sequence number and synchronize


server’s sequence number.

Step 3: ACK (Acknowledge)

• The client receives SYN-ACK.

• It sends back an ACK to the server, acknowledging the server’s


sequence number.

Client → Server : ACK (Seq = x+1, Ack = y+1)

• Purpose: Confirm server’s sequence number.

• Connection is now established, and data transfer can begin.


Diagram of Three-Way Handshake

Client Server

| SYN (Seq=x) |

|------------------------------>|

| SYN-ACK (Seq=y, Ack=x+1)|

|<------------------------------|

| ACK (Seq=x+1, Ack=y+1) |

|------------------------------>|

Connection Established

Key Points

1. TCP is connection-oriented, so handshake is necessary.

2. Sequence numbers are used to keep track of data and ensure


ordered delivery.

3. Ensures that both client and server are ready for communication.

4. Handshake prevents duplicate connections and ensures reliability.

Flow Control

Introduction
Flow control is a mechanism used in the Transport Layer to control the
rate of data transmission between a sender and a receiver.
Its main purpose is to prevent the sender from overwhelming the
receiver with too much data at once.

Why Flow Control is Needed

• The sender can transmit data very fast.

• The receiver may be slower in processing data.

• If too much data is sent too quickly, the receiver’s buffer may
overflow, causing data loss.

• Flow control prevents this by regulating the data flow.

How Flow Control Works

1. Receiver’s Buffer:

o The receiver maintains a buffer to temporarily store incoming


data.

2. Window Size:

o The receiver informs the sender how much free buffer space
it has.

o Sender adjusts the amount of data sent according to this


size.

3. ACKs (Acknowledgements):

o Receiver sends ACKs to the sender for successfully received


data.

o Sender waits or adjusts sending rate based on ACKs.


Flow Control in TCP

TCP uses Sliding Window Protocol for flow control:

• Window Size: Indicates how many bytes can be sent before


receiving an ACK.

• Sliding Window:

o The sender can send multiple segments within the window


size.

o As ACKs arrive, the window slides forward, allowing the


sender to send more data.

Example:

• Receiver buffer = 10 KB

• Sender can send 10 KB of data without waiting for ACK.

• As receiver ACKs arrive, sender can send the next 10 KB, and so on.

Key Points

1. Flow control prevents buffer overflow at the receiver.

2. It ensures smooth data transfer between sender and receiver.

3. It is independent of network speed; it focuses on sender–receiver


processing speed.

4. TCP uses Sliding Window Protocol for flow control.

Error Control

Introduction
Error control is a mechanism used in the Transport Layer to detect and
correct errors that occur during data transmission.
Errors may occur due to noise, congestion, or packet loss in the network.

Its main purpose is to ensure reliable and accurate data delivery between
sender and receiver.

Why Error Control is Needed

• During transmission, data may be corrupted, lost, or duplicated.

• Without error control, the receiver cannot trust the received data.

• Error control guarantees that the correct data reaches the intended
process.

How Error Control Works

1. Error Detection:

o The sender adds a checksum or cyclic redundancy check


(CRC) in the segment header.

o The receiver recalculates the checksum on arrival to detect


errors.

2. Error Correction:

o If an error is detected, the receiver requests retransmission of


the affected data.

3. Acknowledgements (ACK) and Negative Acknowledgements (NAK):

o ACK: Sent when data is received correctly.

o NAK: Sent when data is corrupted, requesting retransmission.


Error Control in TCP

TCP provides reliable error control using:

1. Checksum:

o Each TCP segment has a checksum field to detect errors.

2. Acknowledgements (ACK):

o Receiver sends ACK for correctly received segments.

3. Retransmission:

o If sender does not receive an ACK within a timeout, it resends


the segment.

4. Sequence Numbers:

o Ensures correct order of segments and detects missing or


duplicate segments.

Key Points

1. Error control ensures reliable delivery of data.

2. TCP handles error detection, correction, and retransmission.

3. Works together with flow control to maintain smooth and accurate


communication.

Congestion Control

Introduction

Congestion occurs in a network when too much data is sent into the
network than it can handle.
This can lead to packet loss, delay, and reduced network performance.
Congestion control is a mechanism in the Transport Layer (TCP) to
prevent or control congestion in the network.

Causes of Congestion

1. Too many hosts sending data simultaneously.

2. Slow routers or switches unable to handle traffic.

3. Network bottlenecks due to limited bandwidth.

Types of Congestion Control

Open-Loop Congestion Control

• Also called: Prevention-based method

• Concept: Prevent congestion before it happens.

• How it works:

o Uses techniques like admission control and traffic shaping.

o Regulates data entry into the network to avoid congestion.

• Example techniques:

o Limiting the number of packets sent

o Reserving bandwidth

Key Point: Open-loop is proactive, avoids congestion.

Closed-Loop Congestion Control

• Also called: Feedback-based method

• Concept: React to congestion after it occurs.

• How it works:
o Routers and network devices detect congestion.

o Send feedback signals to the sender to reduce data rate.

• Example techniques in TCP:

1. Slow Start – Gradually increases the sending rate.

2. Congestion Avoidance – Prevents congestion before it becomes


severe.

3. Fast Retransmit & Fast Recovery – Quickly retransmit lost packets.

Key Point: Closed-loop is reactive, reduces congestion after it starts.

TCP Congestion Control Algorithms

1. Slow Start: Start with a small congestion window and increase


gradually.

2. Congestion Avoidance: Increase window slowly to prevent


overload.

3. Fast Retransmit: Retransmit lost segments immediately.

4. Fast Recovery: Avoid restarting slow start completely after packet


loss.

Comparison Table: Open Loop vs Closed Loop

Feature Open Loop Closed Loop

Approach Proactive Reactive

Congestion
Before it occurs After it occurs
Detection
Feature Open Loop Closed Loop

Admission control, Slow start, congestion


Mechanism
traffic shaping avoidance, feedback signals

Complexity Simple More complex

Prevents congestion Can adapt to network


Advantage
completely changes

Cannot handle sudden Only reacts after congestion


Disadvantage
traffic bursts occur
Transport Layer Security (TLS)

Introduction

TLS (Transport Layer Security) is a cryptographic protocol that provides secure


communication over a computer network.
It is widely used to secure internet communications, such as web browsing,
emails, and online transactions.
TLS replaced SSL (Secure Sockets Layer) and is more secure and updated.

Purpose / Functions
TLS ensures that data sent over a network is:
1. Confidential – Data is encrypted so that unauthorized users cannot read
it.
2. Integrity – Ensures that data is not modified or tampered during
transmission.
3. Authentication – Verifies the identity of the communicating parties (e.g.,
server or client).
4. Secure Communication – Prevents eavesdropping and man-in-the-
middle attacks.

How TLS Works


1. Handshake Phase:
o Client and server establish a secure connection.
o They exchange cryptographic keys.
o Agree on encryption algorithms (cipher suites).
2. Encryption Phase:
o Data is encrypted using symmetric encryption for fast transfer.
o Ensures confidentiality.
3. Message Authentication:
o Data includes hash-based checksums (MAC) to verify integrity.

Key Features

Feature Description

Encryption Uses symmetric and asymmetric encryption to secure data

Authentication Verifies the identity of server (and optionally client)

Uses Message Authentication Code (MAC) to prevent


Integrity
tampering

Protocol
TLS 1.0, 1.1, 1.2, 1.3 (latest and most secure)
Version

Applications of TLS

• HTTPS – Secure web browsing


• Email Security – Secure SMTP, IMAP, POP3
• VPNs – Securing remote network access
• Messaging Apps – Encrypting chat messages

Advantages

Ensures secure data transmission over the Internet


Protects against eavesdropping and tampering
Provides server and client authentication
Widely supported and trusted

Disadvantages
Slightly slower than plain TCP due to encryption overhead
Requires certificate management
Stream Control Transmission Protocol (SCTP)

Introduction

SCTP is a transport layer protocol similar to TCP and UDP.


It was designed to combine the reliability of TCP with the message-oriented
nature of UDP.
SCTP is commonly used in telecommunications networks (like signaling in
telephone networks) but also for Internet applications.

Key Features of SCTP

1. Connection-Oriented:
o Like TCP, SCTP establishes a connection between sender and
receiver before data transfer.
2. Reliable Delivery:
o Ensures that all data is delivered correctly and in order.
3. Message-Oriented:
o Unlike TCP, which is stream-oriented, SCTP preserves message
boundaries.
o Each message is delivered as a complete unit.
4. Multi-Homing Support:
o A single SCTP endpoint can have multiple IP addresses.
o Provides redundancy and fault tolerance.
5. Multi-Streaming:
o SCTP can split data into multiple independent streams.
o Prevents head-of-line blocking (one stream blocking others).
6. Four-Way Handshake for Connection:
o More secure than TCP’s three-way handshake.
o Protects against SYN flooding attacks.

Applications of SCTP

Application Description

Telecom Signaling (SS7


For signaling in telephone networks
over IP)

Applications needing reliable message delivery with


Reliable Messaging
preserved message boundaries

WebRTC Data
Real-time communication in browsers
Channels

High Availability
Multi-homing support ensures continuous connectivity
Systems

Comparison with TCP and UDP

Feature TCP UDP SCTP

Connection-
Connection Connectionless Connection-oriented
oriented

Reliability Reliable Unreliable Reliable

Message
Stream Message Message
Orientation

Multi-Streaming

Multi-Homing

Streaming, Telecom, real-time


Use Case Web, email, FTP
gaming messaging
Short Definition
SCTP (Stream Control Transmission Protocol):
SCTP is a connection-oriented, reliable, message-oriented transport layer
protocol that supports multi-streaming and multi-homing, providing efficient
and fault-tolerant data delivery.
Example – Telecom signaling (SS7 over IP), WebRTC data channels.

Simple Analogy

• TCP = Water flowing in a single pipe (stream-oriented).


• UDP = Droplets sent quickly without order.
• SCTP = Multiple small pipes (streams) that deliver entire packages
reliably, with backup pipes for safety.

You might also like