Transport layer Questions and answers
1. Explain Functions of transport layer
Transport Layer Functions
The Transport Layer (Layer 4 of the OSI model) is responsible for end-to-end
communication between source and destination systems. Its main functions are:
1. Process-to-process delivery
Delivers data from a specific process on the source host to the correct process on the
destination host using port numbers.
2. Service-point (port) addressing
Uses port numbers to identify sender and receiver applications (e.g., HTTP → port 80).
3. Segmentation and reassembly
Breaks large messages into smaller segments at the sender and reassembles them at the
receiver.
4. Connection control
Establishes, maintains, and terminates connections (connection-oriented like TCP or
connectionless like UDP).
5. Flow control
Ensures the sender does not overwhelm the receiver by controlling the data transmission
rate.
6. Error control
Detects and corrects errors using acknowledgements, checksums, and retransmissions.
7. Reliable data transfer
Guarantees correct, ordered, and complete delivery of data (mainly in TCP).
8. Congestion control
Adjusts transmission rate to avoid network congestion.
9. Multiplexing and demultiplexing
Allows multiple applications to share the network and ensures data reaches the correct
application.
2. Explain Congestion in Computer Networks
Congestion occurs when the demand for network resources exceeds the available capacity,
causing excessive delay, packet loss, and reduced throughput.
It commonly happens when too many packets are injected into the network at the same time.
Open Loop Congestion Control Techniques
Open loop congestion control aims to prevent congestion before it occurs.
These techniques do not use feedback from the network.
1. Retransmission Policy
good retransmission timers avoid unnecessary retransmissions.
Reduces additional traffic during congestion.
2. Window Policy
Controls the size of the sender’s window.
Smaller window size reduces congestion.
Selective Repeat window is better since it sends the specific packets that have been lost
than go back n window
3. Acknowledgement Policy
Delayed ACKs or cumulative ACKs reduce overhead.
Sending Ack for N Packets since fewer cxk decrease the load on network.
4. Discarding Policy
Less important packets are dropped eventhough the quality of sound still maintain during
heavy traffic.
5. Admission Control
New connections are not allowed if resources are insufficient or there is a congestion.
Closed Loop Congestion Control Techniques
Closed loop congestion control uses feedback from the network to detect and control
congestion after it occurs.
1. Backpressure
Congested node asks upstream nodes to reduce sending rate.
Mainly used in virtual-circuit networks.
2. Choke Packet
Router sends a special packet to source instructing it to slow down.
3. Implicit Feedback
Sender guesses there will be a congestion through packet loss, timeout, or delay.
4. Explicit Feedback
Network explicitly informs sender about congestion.
Example: Explicit Congestion Notification (ECN).
5. TCP Congestion Control
Uses algorithms like:
o Slow Start
o Congestion Avoidance
o Fast Retransmit
o Fast Recovery
3. Flow Control Techniques in the Transport Layer to
Improve QoS
Quality of Service (QoS) refers to the ability of a network to provide better service to selected
traffic, ensuring required bandwidth, delay, jitter, and reliability.
To improve QoS, the transport layer uses the following flow control–related techniques:
1. Scheduling
Scheduling determines the order in which packets are transmitted when multiple flows
compete for network resources.
Types of Scheduling
FIFO (First In First Out)
Packets are served in arrival order.
Priority Scheduling
High-priority traffic (voice/video) is transmitted before low-priority traffic.
Weighted Fair Queuing (WFQ)
Bandwidth is shared fairly among flows based on assigned weights.
2. Traffic Shaping
Traffic shaping regulates the rate at which data is sent into the network to avoid congestion
and burst traffic.
Common Traffic Shaping Algorithms
Leaky Bucket Algorithm
Outputs data at a constant rate regardless of input burst.
Token Bucket Algorithm
Allows controlled bursts while maintaining an average rate.
Role in QoS
Controls jitter and delay
Prevents congestion
Smoothens traffic flow
3. Admission Control
Admission control decides whether a new flow or connection can be accepted based on
available resources.
Working
Network checks bandwidth, buffer, and delay requirements
Accepts flow only if QoS can be guaranteed
Otherwise, request is rejected or delayed
Role in QoS
Prevents overloading of network
Ensures existing connections maintain QoS
Important for real-time applications
4. Resource Reservation
Resource reservation allocates network resources in advance for specific data flows.
Reserved Resources
Bandwidth
Buffer space
Processing capacity
Protocol Example
RSVP (Resource Reservation Protocol)
Role in QoS
Guarantees bandwidth and delay
4. Explain TCP protocol
TCP (Transmission Control Protocol)
TCP is a connection-oriented, reliable transport layer protocol used for accurate and ordered
delivery of data over a network. It operates at the Transport Layer (Layer 4) of the OSI model.
TCP Connection Establishment (Three-Way Handshake)
1. SYN – Sender requests connection
2. SYN + ACK – Receiver acknowledges and agrees
3. ACK – Sender confirms; connection established
TCP Connection Termination (Four-Way Handshake)
1. FIN – Sender requests termination
2. ACK – Receiver acknowledges
3. FIN – Receiver closes its side
4. ACK – Sender confirms termination
TCP Segment Format (Figure)
0 15 31
+-------------------+-------------------+
| Source Port | Destination Port |
+-------------------+-------------------+
| Sequence Number |
+---------------------------------------+
| Acknowledgement Number |
+---------------------------------------+
| Hdr |Res|U|A|P|R|S|F| Window Size |
| Len | |R|C|S|S|Y|I| |
+-------------------+-------------------+
| Checksum | Urgent Pointer |
+-------------------+-------------------+
| Options (if any) + Padding |
+---------------------------------------+
| Data |
+---------------------------------------+
Explanation of TCP Header Fields
1. Source Port (16 bits)
Identifies the sending application.
2. Destination Port (16 bits)
Identifies the receiving application.
3. Sequence Number (32 bits)
Indicates the number of the first byte of data in this segment.
4. Acknowledgement Number (32 bits)
Specifies the next byte expected from the sender.
5. Header Length (Data Offset)
Length of TCP header in 32-bit words.
6. Reserved Bits
Reserved for future use (set to zero).
7. Control Flags (6 bits)
o URG – Urgent pointer valid
o ACK – Acknowledgement valid
o PSH – Push data immediately
o RST – Reset connection
o SYN – Synchronize sequence numbers
o FIN – Terminate connection
8. Window Size (16 bits)
Specifies how much data the receiver can accept (flow control).
9. Checksum (16 bits)
Used for error detection of header and data.
10. Urgent Pointer (16 bits)
Indicates urgent data end position (used with URG flag).
11. Options and Padding
Provides additional functions like maximum segment size (MSS).
12. Data (Payload)
Actual data being transmitted.
Advantages of TCP
Reliable and ordered delivery
Error-free communication
Suitable for critical data
Disadvantages of TCP
Slower compared to UDP
More overhead
Applications of TCP
Web browsing (HTTP/HTTPS)
Email (SMTP, POP, IMAP)
File transfer (FTP)
Remote login (SSH, Telnet)
4. Explain UDP Protocol
UDP (User Datagram Protocol)
UDP is a connectionless, unreliable, and fast transport layer protocol. It operates at the
Transport Layer (Layer 4) of the OSI model and is used where speed is more important than
reliability.
Key Characteristics of UDP
1. Connectionless protocol
No connection is established before data transmission.
2. Unreliable delivery
No guarantee of delivery, order, or duplication control.
3. No flow control
Sender transmits data without considering receiver capacity.
4. No congestion control
Does not adjust transmission rate based on network traffic.
5. Low overhead
Small header size (only 8 bytes), making it faster than TCP.
6. Message-oriented
Each UDP segment is sent as an independent datagram.
UDP Segment Format (Figure)
0 15 31
+---------------+---------------+
| Source Port | Destination |
| | Port |
+---------------+---------------+
| Length | Checksum |
+---------------+---------------+
| |
| Data (Payload) |
| |
+-------------------------------+
Explanation of UDP Header Fields
1. Source Port (16 bits)
Port number of the sending application (optional).
2. Destination Port (16 bits)
Port number of the receiving application.
3. Length (16 bits)
Total length of UDP header and data.
4. Checksum (16 bits)
Used for error detection (optional in IPv4, mandatory in IPv6).
5. Data
Actual application data being transmitted.
How UDP Works (Instead of Connection Establishment)
The sender directly sends datagrams to the receiver.
Each UDP segment is independent and contains:
o Source port
o Destination port
o Length
o Checksum
The receiver does not send acknowledgements.
There is no confirmation that the receiver is ready.
Advantages of UDP
Faster transmission
Low protocol overhead
Suitable for real-time applications
Disadvantages of UDP
No reliability
No error recovery
No ordered delivery
Applications of UDP
DNS
Video streaming
Online gaming
Voice over IP (VoIP)
Live broadcasts
SCTP (Stream Control Transmission Protocol)
SCTP is a transport layer, reliable, message-oriented and connection-oriented protocol
designed to overcome limitations of TCP and UDP.
It is widely used in telecommunication and signaling networks.
1. Services Provided by SCTP
SCTP provides the following important services:
1. Process-to-process delivery
Uses port numbers similar to TCP and UDP.
2. Reliable data transfer
Ensures error-free delivery using acknowledgements and retransmissions.
3. Message-oriented service
Preserves message boundaries (unlike TCP which is byte-stream oriented).
4. Multi-streaming
Supports multiple independent streams within a single connection, preventing head-of-
line blocking.
5. Multi-homing
Supports multiple IP addresses for a single endpoint, improving fault tolerance.
6. Flow control
Uses window-based flow control to prevent receiver overflow.
7. Congestion control
Similar to TCP congestion control mechanisms.
8. Ordered and unordered delivery
Allows both ordered and unordered message delivery.
2. SCTP Segment (Packet) Format – Figure
An SCTP packet consists of a common header followed by one or more chunks.
0 15 31
+-------------------+-------------------+
| Source Port | Destination Port |
+-------------------+-------------------+
| Verification Tag |
+---------------------------------------+
| Checksum |
+---------------------------------------+
| |
| Chunk (Data / Control) |
| |
+---------------------------------------+
Explanation of SCTP Header Fields
1. Source Port (16 bits)
Port number of sending application.
2. Destination Port (16 bits)
Port number of receiving application.
3. Verification Tag (32 bits)
Used to validate the association and protect against stale packets.
4. Checksum (32 bits)
Provides strong error detection.
5. Chunks
SCTP data and control information are carried as chunks
o DATA chunk
o INIT, INIT-ACK
o COOKIE-ECHO, COOKIE-ACK
o SACK, HEARTBEAT, etc.
3. SCTP Connection-Oriented Association
In SCTP, a connection is called an association.
SCTP Association Establishment (Four-Way Handshake)
Client Server
| -------- INIT ----------> |
| <----- INIT-ACK ----------|
| -------- COOKIE-ECHO ---> |
| <----- COOKIE-ACK --------|
Steps:
1. INIT
Client requests association.
2. INIT-ACK
Server responds with parameters and a cookie.
3. COOKIE-ECHO
Client sends cookie back to server.
4. COOKIE-ACK
Server confirms association establishment.
✔ This method protects against SYN flooding attacks.
Key Differences: TCP vs SCTP (Quick Point)
TCP → 3-way handshake
SCTP → 4-way handshake with cookie mechanism
SCTP supports multi-streaming and multi-homing
Application Layer Protocols
[Link] Protocol
Definition
DNS (Domain Name System) is an application-layer protocol that translates human-readable
domain names (like [Link]) into IP addresses (like [Link]) so that
computers can locate each other on a network.
Think of DNS as the phonebook of the Internet.
DNS Services
1. Name Resolution – Converts domain names to IP addresses
2. Mail Server Resolution – Locates mail servers for a domain
3. Load Distribution – Maps one domain to multiple IP addresses
DNS Components
1. Domain Name Space
o Hierarchical structure
o Example: .com, .edu, .org
2. DNS Servers
o Root Server
o Top Level Domain (TLD) Server
o Authoritative Server
o Local DNS Server
3. Resolvers
o Client-side software that sends DNS queries
DNS Working (Name Resolution Process)
[Link] passes the hostname to FT client
[Link] FT client passes the host name to the DNS client(resolver)
[Link] client sends a message to a DNS server with a query that gives the FT
server name using known ip address of DNS server.
[Link] server responds with the IP address of the desired file transfer server
[Link] server passes the ip address to the FT client
[Link] FT client now uses the received IP address to access the FT server
Domain name space
It is a hierarchical name space. Sequence of labels separated by dots.
[Link]
Here names are defined in an inverted tree structure with root at the top.
The tree can have only 128 levels(0 to 127)
Each node has a label with a maximum of 63 [Link] label is a null string.
This means that a fully qualified domain name consists of all domain levels from
host name to root domain.
www host name
cs sub domain
example domain name
edu top level domain
actual fqdn is [Link]. Usually we omit the dot at the last
Partially qualified domain name not include all domains.
Example www
The domain name space is divided into three different sections: generic domains,
country domains, and inverse domain.
• Generic Domains
• It does not linked to any country they usually indicate the type of
organization or purpose.
• It uses three-character labels, and these labels describe the organization type.
• ,com,.edu
• Country Domain
• It is associated with specific country. it uses two-character country
abbreviations (e.g., us for the United States) in place of three character
organizational abbreviations.
• Inverse Domain
• The inverse domain is used for mapping an ip address to a domain name.
• Huge information is stored in one computer is not practical.
• We distribute the information among many computers called DNS servers.
• A host that needs to map address to a name or name to a address calls DNS
client called resolver.
• The resolver access the closest DNS server with a mapping request.
• If the server has the information it satisfies the resolver.
• Otherwise it refers the resolver to ask other servers to provide information.
• Finally the resolver delivers the result to process that requested it.
Remote Login (TELNET)
Definition
Remote login allows a user to access and control a remote computer over a network as if they
were locally logged in.
TELNET (TELecommunication NETwork) is a remote login protocol that enables this
functionality.
TELNET Protocol
What is TELNET?
TELNET is an application-layer protocol used to log into a remote machine and execute
commands. Developed in early ARPANET days. Uses client–server architecture
Port Number
TCP Port 23
How TELNET Works
1. User runs a TELNET client
2. Client establishes a TCP connection with the TELNET server
3. User enters username and password
4. Commands typed locally are executed on the remote machine
5. Output is sent back to the user
Operates using a Network Virtual Terminal (NVT) concept
Network Virtual Terminal (NVT)
Standard interface for communication
Client converts local keyboard input into NVT format
Server converts NVT data into local format
What is E-mail?
Electronic mail (E-mail) is an application-layer service that allows users to send and receive
messages over a computer network or the Internet.
SMTP (Simple Mail Transfer Protocol)
Definition
SMTP is an application-layer protocol used for sending e-mails from a client to a mail server
and between mail servers.
📌 SMTP is used only for sending, not for receiving e-mails.
Position in Network Layers
OSI Model: Application Layer
TCP/IP Model: Application Layer
Port Numbers
25 – Server to server mail transfer
587 – Mail submission (client to server)
465 – Secure SMTP (SMTPS)
Components of E-mail System
1. User Agent (UA) – Email client (Gmail, Outlook)
2. Mail Transfer Agent (MTA) – Transfers mail (SMTP)
3. Mail Delivery Agent (MDA) – Stores mail
4. Mail Server – Handles sending and receiving
Working of SMTP
1. Sender composes email using a User Agent
2. Email is sent to the sender’s mail server
3. SMTP transfers the message to the receiver’s mail server
4. Email is stored in receiver’s mailbox
5. Receiver reads email using POP3 or IMAP
SMTP Commands
Command Function
HELO / EHLO Identify sending server
MAIL FROM Sender address
RCPT TO Receiver address
DATA Message content
QUIT End session
SMTP Characteristics
Text-based protocol
Uses TCP for reliable delivery
Push protocol
ASCII-based commands
Advantages
Simple and reliable
Widely supported
Efficient for mail transfer
Limitations
Cannot retrieve emails
Originally no encryption
Limited attachment support (needs MIME)
MIME (Multipurpose Internet Mail Extensions)
Extends SMTP capabilities
Supports:
o Attachments
o Non-ASCII text
o Images, audio, video
FTP (File Transfer Protocol)
Definition
FTP is an application-layer protocol used to transfer files between a client and a server over a
TCP/IP network.
Position in Network Layers
OSI Model: Application Layer
TCP/IP Model: Application Layer
Port Numbers Used
FTP uses two TCP connections:
Connection Port Purpose
Control Connection 21 Commands and responses
Data Connection 20 File transfer
FTP Architecture
Client–Server model
Control connection remains open throughout the session
Data connection opens and closes for each file transfer
Working of FTP
1. Client establishes control connection with server (port 21)
2. User authentication (username & password)
3. Client sends FTP commands
4. Data connection is established for file transfer
5. File is uploaded or downloaded
6. Connection is terminated
FTP Commands
Command Function
USER Username
PASS Password
LIST List files
RETR Download file
STOR Upload file
QUIT End session
Modes of FTP
1. Active Mode
Server initiates data connection to client
Uses port 20
2. Passive Mode
Client initiates both connections
More firewall-friendly
Types of FTP Access
1. Anonymous FTP – Public access without credentials
2. Authenticated FTP – Requires username & password
Advantages
Simple and efficient
Supports large file transfers
Allows file upload and download
Disadvantages
No encryption (passwords sent in plain text ❌)
Firewall issues
Less secure compared to modern protocols
WWW (World Wide Web)
Definition
The World Wide Web (WWW) is a distributed information system that allows users to
access, share, and navigate hypertext documents over the Internet using a web browser.
📌 WWW is not the Internet; it is a service that runs on the Internet.
Components of WWW
1. Web Browser
o Client software (Chrome, Firefox)
2. Web Server
o Stores and delivers web pages (Apache, Nginx)
3. Web Pages
o Documents written in HTML
4. Uniform Resource Locator (URL)
o Address of a web resource
5. Hyperlinks
o Connect web pages together
WWW Architecture
Client–Server Model
Browser (client) requests resources
Server responds with web content
Protocols Used in WWW
Protocol Purpose
HTTP Transfer web pages
HTTPS Secure web communication
FTP File transfer
SMTP Sending emails
DNS Name resolution
Working of WWW
1. User enters a URL in the browser
2. DNS resolves domain name to IP address
3. Browser sends HTTP request to web server
4. Server returns HTML page
5. Browser renders the page
URL Structure
Example: [Link]
https → Protocol
[Link] → Domain name
[Link] → Resource path
Features of WWW
Hypertext navigation
Multimedia support
Platform independent
Distributed system
HTTP (HyperText Transfer Protocol)
Definition
HTTP is an application-layer protocol used for transferring hypertext documents (web
pages) between a web browser (client) and a web server on the World Wide Web.
Position in Network Layers
OSI Model: Application Layer
TCP/IP Model: Application Layer
Port Numbers
HTTP – Port 80
HTTPS – Port 443 (secure)
HTTP Architecture
Client–Server model
Browser sends request
Server sends response
Working of HTTP
1. User enters a URL in browser
2. DNS resolves domain name to IP address
3. Browser sends HTTP request to server
4. Server processes request
5. Server sends HTTP response
6. Browser displays web page
HTTP Characteristics
Stateless protocol (each request is independent)
Text-based
Uses TCP for reliable delivery
Request–response model
HTTP Request Methods
Method Purpose
GET Retrieve data
POST Submit data
PUT Update data
DELETE Delete data
HEAD Fetch headers only
HTTP Response Status Codes
Code Meaning
200 OK
301 Moved Permanently
400 Bad Request
401 Unauthorized
404 Not Found
500 Internal Server Error
HTTP Message Format
Request Message
Request line
Headers
Blank line
Message body
Response Message
Status line
Headers
Blank line
Message body
Limitations of HTTP
No security (data in plain text ❌)
Stateless nature increases overhead
SNMP (Simple Network Management Protocol)
Definition
SNMP is an application-layer protocol used to monitor, manage, and control network
devices such as routers, switches, servers, and printers over an IP network.
Position in Network Layers
OSI Model: Application Layer
TCP/IP Model: Application Layer
SNMP Components
1. SNMP Manager
o Central management system
o Collects and analyzes network data
2. SNMP Agent
o Runs on managed devices
o Collects device information
3. Managed Devices
o Routers, switches, servers, printers
4. MIB (Management Information Base)
o Database of managed objects
o Each object identified by an OID
SNMP Architecture
Manager–Agent model
Agent reports device status to manager
SNMP Operations (Messages)
Operation Function
GET Retrieve value from agent
SET Modify value on agent
GET-NEXT Get next MIB object
RESPONSE Reply from agent
TRAP Unsolicited alert to manager
INFORM Confirmed notification
SNMP Versions
Version Features
SNMPv1 Basic, insecure
SNMPv2c Improved performance
SNMPv3 Secure (authentication & encryption)
Transport Protocol & Ports
Uses UDP
Port 161 – SNMP requests/responses
Port 162 – Traps and informs
Advantages
Simple and lightweight
Centralized network management
Widely supported