Computer Networks Unit 4
Created @November 7, 2024 10:02 PM
Class CN 201
The OSI Model (Open Systems Interconnection) is a conceptual framework used
to understand how different network protocols interact to enable communication
across diverse systems. While the model has seven layers, we will focus on the
Transport layer (Layer 4) and the three upper layers, namely the Session (Layer
5), Presentation (Layer 6), and Application (Layer 7) layers.
Overview of the OSI Model's Transport and
Upper Layers
1. Transport Layer (Layer 4)
2. Session Layer (Layer 5)
3. Presentation Layer (Layer 6)
4. Application Layer (Layer 7)
Each layer plays a distinct role, allowing applications to communicate seamlessly,
even over complex networks.
1. Transport Layer (Layer 4)
Role: The Transport layer provides end-to-end communication services and
ensures that data is transferred accurately and reliably between devices on a
network.
Key Functions:
Segmentation and Reassembly: It breaks down large data into smaller
segments for easier transmission, and reassembles them on the receiving end.
Computer Networks Unit 4 1
Flow Control: It manages the rate of data transmission to avoid overwhelming
the receiver, which can prevent congestion.
Error Control: This layer detects and corrects errors in the data to ensure
reliability.
Connection Establishment and Termination: It establishes and closes logical
connections between sender and receiver.
Protocols:
TCP (Transmission Control Protocol): TCP is a connection-oriented protocol
that ensures reliable data transfer. It uses acknowledgments, error detection,
and retransmission of lost packets.
UDP (User Datagram Protocol): UDP is connectionless and faster than TCP
but does not guarantee delivery, often used for applications that need real-
time data (e.g., video streaming, gaming).
Analogy: Imagine a delivery service that carefully packs items, ensures they
arrive intact, and even checks for damage. TCP would represent a careful,
guaranteed delivery service, whereas UDP would be a faster option, similar to a
quick parcel delivery without checking for receipt confirmation.
2. Session Layer (Layer 5)
Role: The Session layer manages and controls the dialog between two devices,
maintaining, establishing, and terminating connections, or “sessions,” between
networked devices.
Key Functions:
Session Management: It sets up, coordinates, and terminates conversations
between applications.
Synchronization: For applications that require data synchronization (like file
transfers), this layer provides checkpoints to ensure continuity in the case of
interruptions.
Dialog Control: It manages the two-way data exchange, supporting either full-
duplex or half-duplex communication.
Example:
Computer Networks Unit 4 2
When you log into a remote desktop, the Session layer controls the start and
end of your session and ensures the dialog continues smoothly without
disruptions.
Protocols:
NetBIOS and PPTP (Point-to-Point Tunneling Protocol): NetBIOS is used for
basic session management in small networks, while PPTP is often used for
establishing VPN sessions.
Analogy: Think of a phone call where you agree on when to start, exchange
information back and forth, and eventually hang up. The session layer ensures
both parties stay connected for the entire duration of the conversation.
3. Presentation Layer (Layer 6)
Role: The Presentation layer is responsible for translating, encrypting, and
compressing data between the application and network formats. Essentially, it
serves as the "translator" between application formats and network formats.
Key Functions:
Data Translation: Converts data into a format understood by both the sending
and receiving applications.
Example: Converting data between different encoding schemes (like ASCII
for text, or JPEG for images).
Encryption and Decryption: Secures data by encrypting it before transmission
and decrypting it upon receipt.
Example: When using HTTPS, the data encryption occurs at this layer.
Data Compression: Reduces the amount of data that needs to be transmitted
to save bandwidth.
Example: Compressing images or videos before sending them online.
Protocols:
SSL (Secure Sockets Layer) and TLS (Transport Layer Security): These are
widely used for encrypting data in secure web sessions, particularly in e-
commerce and banking.
Computer Networks Unit 4 3
Analogy: Imagine this layer as a customs checkpoint that converts currencies,
encrypts valuable items, and compresses luggage to make it more manageable for
transport.
4. Application Layer (Layer 7)
Role: The Application layer is the closest layer to the end-user. It enables software
applications to communicate over the network, making network services
accessible to users.
Key Functions:
Resource Sharing: Allows networked applications to share resources such as
files, printers, and databases.
Network Services: Provides services directly to end-user applications like
email, file transfer, and web browsing.
Protocol Support: Supports various protocols that allow these services, each
designed for specific application types.
Protocols:
HTTP (Hypertext Transfer Protocol): Used for transferring web pages.
FTP (File Transfer Protocol): Used for transferring files.
SMTP (Simple Mail Transfer Protocol): Used for sending emails.
Example:
When you visit a website, your browser (an application) communicates with
the web server over HTTP, facilitated by the Application layer.
Analogy: Imagine this layer as the final delivery to the recipient's door, where the
user interacts with the data and accesses the services they requested.
Diagram of Transport and Upper Layers in the OSI Model
A simplified diagram would look like this:
+------------------------+
| Application Layer | ← Protocols like HTTP, FTP, SMTP
Computer Networks Unit 4 4
+------------------------+
| Presentation Layer | ← Protocols like SSL/TLS
+------------------------+
| Session Layer | ← Protocols like NetBIOS, PPTP
+------------------------+
| Transport Layer | ← Protocols like TCP, UDP
+------------------------+
Key Differences in the Upper Layers of OSI and TCP/IP Models
The TCP/IP model combines the functions of the OSI Session, Presentation, and
Application layers into a single Application Layer. Therefore, the Transport Layer
in the TCP/IP model handles most of the duties of the OSI's Session and
Presentation layers, making it a simpler framework for modern internet
applications.
Summary Table
OSI Layer Role Key Protocols Analogy
Reliable/quick parcel
Transport Reliable data delivery TCP, UDP
delivery
Manages sessions Phone call setup and
Session NetBIOS, PPTP
between applications teardown
Translates, encrypts, Customs checkpoint for
Presentation SSL/TLS
and compresses currency and security
User-interacting
Interfaces with end-user HTTP, FTP,
Application applications like browsers,
applications SMTP
email
Transport Layer: Functions and Protocols
The Transport Layer (Layer 4 in the OSI model) is responsible for delivering data
from a source device to a destination device reliably and efficiently. It provides
Computer Networks Unit 4 5
communication services directly to the application processes running on different
hosts and is crucial for managing end-to-end communication.
Key Functions of the Transport Layer
1. Segmentation and Reassembly
Large messages are broken into smaller segments, which are reassembled
at the destination.
This enables data to be efficiently transmitted across the network, even if
the network has limitations on packet size.
2. Connection Establishment and Termination
The transport layer establishes a connection between the sender and
receiver (session management).
This process typically involves a handshake to set up and end connections
gracefully.
3. Flow Control
The transport layer manages data flow between the sender and receiver to
ensure that the sending rate does not overwhelm the receiver.
Flow control mechanisms prevent congestion by allowing the sender to
adjust based on the receiver's capabilities.
4. Error Control
Errors may occur in the transmission due to noise, congestion, etc.
The transport layer checks for errors in the transmitted segments and
ensures that they are retransmitted if necessary, to guarantee reliable
delivery.
5. Multiplexing and Demultiplexing
Multiplexing allows multiple applications on a host to use the network
simultaneously.
The transport layer tags each segment with port numbers, allowing data to
reach the correct application at the destination (demultiplexing).
Computer Networks Unit 4 6
6. Data Integrity and Reliability
Ensures that data reaches the receiver accurately and in the correct
sequence.
Reliability mechanisms ensure retransmission of lost or corrupted
segments, providing reliable communication channels.
Major Protocols at the Transport Layer
1. Transmission Control Protocol (TCP)
TCP is a connection-oriented protocol, meaning it establishes a
connection before data transfer.
It provides reliable data transfer, ensuring that data is sent in sequence
and is complete.
Key features include:
Connection Establishment: Uses a three-way handshake to start
communication.
Reliability: Ensures data integrity through sequence numbers and
acknowledgment.
Flow Control: Uses a sliding window mechanism to manage data flow
between sender and receiver.
Error Control: Detects errors through checksum and retransmits
erroneous or lost segments.
2. User Datagram Protocol (UDP)
UDP is a connectionless protocol, which does not establish a connection
before data transfer.
It is faster and simpler than TCP but lacks reliability features.
Key features include:
No Connection Setup: Allows faster transmission as no handshake is
required.
Computer Networks Unit 4 7
Low Overhead: Does not implement flow control or error recovery,
which reduces processing requirements.
Best-Effort Delivery: Suitable for applications where speed is more
critical than reliability (e.g., streaming, online gaming).
UDP is typically used for applications that can tolerate some data loss but
need real-time communication.
3. Stream Control Transmission Protocol (SCTP)
SCTP combines features of both TCP and UDP.
It is a connection-oriented protocol that provides both reliable data
transfer and support for multiple streams within a single connection.
Key features include:
Multi-Streaming: Supports multiple independent streams, reducing
the risk of blocking.
Multi-Homing: Allows a connection to span multiple IP addresses,
enhancing reliability.
Error and Flow Control: Provides mechanisms to detect errors and
control data flow.
Comparison of TCP, UDP, and SCTP
Feature TCP UDP SCTP
Connection Type Connection-oriented Connectionless Connection-oriented
Reliability Reliable Unreliable Reliable
Error Control Yes No Yes
Flow Control Yes No Yes
Speed Slower than UDP Faster than TCP Moderate
Use Cases Email, file transfer, web Streaming, gaming VoIP, SS7 signaling
Multi-Streaming No No Yes
Multi-Homing No No Yes
Computer Networks Unit 4 8
Real-World Applications of Transport Layer Protocols
TCP: Used in applications requiring reliability, such as web browsers
(HTTP/HTTPS), email (SMTP), file transfers (FTP), and remote login (SSH).
UDP: Used in time-sensitive applications, such as online video streaming, VoIP
(Voice over IP), and online gaming, where speed is prioritized over reliability.
SCTP: Used in applications like telecommunication signaling (e.g., SS7) and
certain real-time applications requiring reliable and ordered delivery with low
delay.
Summary
The transport layer is fundamental for efficient communication between devices
across a network. Through protocols like TCP, UDP, and SCTP, it provides both
reliable and fast data transfer tailored to different application needs.
Functions of the Session Layer (Layer 5 in
the OSI Model)
The Session Layer is responsible for managing and controlling the dialogue
(communication) between two devices or processes. It establishes, maintains, and
terminates sessions between applications. It ensures that data is properly
synchronized, and it manages data exchange during the session. Key functions of
the Session Layer include:
1. Session Establishment, Maintenance, and Termination:
Establishment: The session layer sets up and coordinates the
communication between two devices, determining which communication
method will be used (e.g., full-duplex, half-duplex).
Maintenance: It ensures continuous communication by maintaining
session parameters during data transfer.
Termination: Once data transfer is completed, the session layer gracefully
ends the communication session.
Computer Networks Unit 4 9
2. Synchronization:
The session layer provides synchronization for data streams, inserting
checkpoints or synchronization points to allow data recovery if a
communication failure occurs.
These checkpoints enable the resumption of data exchange without
needing to resend the entire message (useful for large data transfers).
3. Dialog Control:
The session layer manages the dialogue between devices, determining
whether the communication is half-duplex (one-way communication at a
time) or full-duplex (both devices can send and receive simultaneously).
It ensures that data is transferred in the correct order and maintains the
flow of communication between sender and receiver.
4. Error Handling and Recovery:
It may provide error detection and recovery at the session level by using
mechanisms such as acknowledgments or timeouts.
If an error occurs during the session, the session layer can handle
retransmissions, ensuring the session's reliability.
5. Session Layer Protocols:
NetBIOS (Network Basic Input/Output System): Used for session
management in local area networks (LANs) for file sharing and printing.
RPC (Remote Procedure Call): Allows a program to request a service from
another program located on a different device.
SQL: In database systems, SQL manages sessions between clients and
databases to carry out transactions.
6. Token Management:
The session layer can manage tokens for controlling access to the
communication channel in a network to avoid conflicts (e.g., preventing
two devices from transmitting at the same time).
7. Session Layer APIs:
Computer Networks Unit 4 10
Provides APIs (Application Programming Interfaces) that allow
developers to implement and manage session control in their applications,
including the creation of new sessions, session persistence, and secure
communication.
Summary
The Session Layer primarily manages the process of communication between
applications, ensuring that data is properly organized, synchronized, and error-
free during transfer. It provides mechanisms for session initiation, data
synchronization, dialog control, and recovery from errors, making it a critical layer
for reliable communication.
Presentation Layer (Layer 6 in the OSI
Model)
The Presentation Layer is responsible for translating, encrypting, and
compressing data between the application layer and the session layer. It ensures
that data is in a format that the receiving application can understand, regardless of
how the data is structured or encoded on the sender’s side.
Key Functions of the Presentation Layer:
1. Data Translation:
The Presentation Layer is responsible for converting data into a format that
can be understood by the receiving application.
It handles data encoding and decoding, ensuring that both sender and
receiver interpret data correctly (e.g., converting between different
character encoding formats such as ASCII and Unicode).
2. Data Compression:
It compresses data to reduce the amount of data being transmitted,
improving network efficiency.
Computer Networks Unit 4 11
The Presentation Layer also decompresses data when it reaches the
receiver.
3. Data Encryption and Decryption:
The Presentation Layer can encrypt data before transmission, ensuring
privacy and security.
Upon receiving data, it decrypts it so the receiving application can
understand the information in its original format.
This encryption/decryption ensures data security during transmission
(e.g., SSL/TLS protocols).
4. Syntax and Semantics:
The Presentation Layer ensures that data is sent in a syntax that both the
sender and receiver understand. This includes converting data structures
into a standard format.
5. Protocol Transformation:
If different systems use different formats for data representation, the
Presentation Layer can handle protocol conversion, allowing
interoperability between different systems.
Example Protocols and Services:
SSL/TLS (Secure Sockets Layer/Transport Layer Security): Ensures secure
data transmission by encrypting data at the Presentation Layer.
MIME (Multipurpose Internet Mail Extensions): Used in email systems to
encode and decode multimedia content (such as images and videos).
JPEG, GIF, PNG: Image formats where the Presentation Layer handles image
compression and format conversion.
Application Layer (Layer 7 in the OSI Model)
The Application Layer is the topmost layer in the OSI model, directly interacting
with the end user or application. It provides the interface and services that
Computer Networks Unit 4 12
applications need to access network resources and communicate over the
network.
Key Functions of the Application Layer:
1. Network Services to Applications:
The Application Layer provides the necessary services for applications to
communicate over the network, such as file transfer, email, web browsing,
and database access.
It enables programs like web browsers, email clients, and chat applications
to interact with the network.
2. Data Representation:
It is responsible for ensuring that the data sent from an application is
formatted correctly for transmission over the network.
This can include converting text to a specific encoding or structuring data
in a way that the receiving application understands.
3. Session Management:
In some cases, the Application Layer may assist with the creation and
management of communication sessions between applications (though
the Session Layer primarily handles session management).
4. End-to-End Communication:
The Application Layer ensures that data reaches its destination by utilizing
transport protocols (such as TCP) to send data to the destination.
It allows users to interact with applications via protocols that support end-
to-end communication, like HTTP, FTP, SMTP, etc.
5. User Interface (UI) Interaction:
It enables the end user to interact with network applications, such as web
browsing (HTTP/HTTPS), file transfers (FTP), or email (SMTP/IMAP/POP).
Common Application Layer Protocols:
Computer Networks Unit 4 13
HTTP (Hypertext Transfer Protocol): Used for web browsing and retrieving
web pages from servers.
FTP (File Transfer Protocol): Used to transfer files between a client and a
server over a network.
SMTP (Simple Mail Transfer Protocol): Used for sending email.
IMAP/POP (Internet Message Access Protocol/Post Office Protocol): Used to
retrieve email messages from a server.
DNS (Domain Name System): Translates human-readable domain names into
IP addresses.
DHCP (Dynamic Host Configuration Protocol): Automatically assigns IP
addresses to devices on a network.
Summary: Comparison of Presentation and Application Layers
Feature Presentation Layer Application Layer
Data translation, encryption, End-user application interaction,
Primary Function
and compression network service access
Data formatting and syntax Provides network services like web
Responsibility
translation between systems browsing, file transfer
Handles data encoding,
Data Handles user and application
decoding, and format
Representation interactions with the network
conversion
Provides encryption and Not responsible for security, but
Security
decryption uses secure protocols (e.g., HTTPS)
Protocol
SSL/TLS, JPEG, GIF, PNG HTTP, FTP, SMTP, DNS, DHCP
Examples
Layer Number Layer 6 (OSI Model) Layer 7 (OSI Model)
In short, the Presentation Layer is responsible for preparing data for transmission,
ensuring it is in the correct format, while the Application Layer provides the
interface for end-users or applications to access network resources and services.
Computer Networks Unit 4 14