Module 5 Notes
Module 5 Notes
&
APPLICATION LAYER
Prepared by: (1) Dr Tanvir H Sardar, Associate Professor, Dept. of CSE, 2024-25 and (2)
THE TRANSPORT LAYER
5.1. The Transport Service
5.1.1 Services Provided to the Upper Layers
5.1.2 Transport Service Primitives
5.1.3 Berkeley Sockets
5.1.4 An Example of Socket Programming: An Internet File Server
5.2. Elements of Transport Protocols
5.2.1 Addressing
5.2.2 Connection Establishment
5.2.3 Connection Release
5.2.4 Error Control and Flow Control
5.2.5 Multiplexing
5.2.6 Crash Recovery
THE APPLICATION LAYER
5.3. DNS — The Domain Name System
5.3.1 History and Overview
5.3.2 The DNS Lookup Process
5.3.3 The DNS Name Space and Hierarchy
5.3.4 DNS Queries and Responses
5.3.5 Name Resolution
5.3.6 Hands on with DNS
5.3.7 DNS Privacy
5.3.8 Contention Over Names
5.4. Electronic Mail
5.4.1 Architecture and Services
5.4.2 The User Agent
5.4.3 Message Formats
5.4.4 Message Transfer
5.4.5 Final Delivery
5.5. WWW
5.5.1 Architectural Overview
5.5.2 Static Web Objects
5.5.3 Dynamic Web Pages and Web Applications
5.5.4 HTTP and HTTPS
5.5.5 Web Privacy
5.6. Streaming Audio and Video
5.6.1 Digital Audio
5.6.2 Digital Video
5.6.3 Streaming Stored Media
5.6.4 Real-Time Streaming
THE TRANSPORT LAYER
5.1. The Transport Service
This section introduces the transport service, focusing on the type of service it provides to the
application layer. It begins with an overview of transport layer primitives, starting with a simple
hypothetical example to illustrate basic concepts, followed by the commonly used Internet interface.
5.1.1 Services Provided to the Upper Layers
The transport layer aims to provide efficient, reliable, and cost-effective data transmission services to
the application layer by utilizing the network layer's services. The main component of the transport
layer, the transport entity, can reside in the operating system, library packages, or even hardware like
network interface cards.
1. Error Control:
o Both layers must ensure data integrity and reliability through mechanisms like
retransmissions and acknowledgements.
2. Sequencing:
o Maintaining the correct order of data delivery is essential for both layers.
3. Flow Control:
o Both layers regulate the data rate between sender and receiver to prevent buffer
overflows and data loss.
1. Environment:
o Data Link Layer:
▪ Operates between two directly connected devices using a physical link (wired or
wireless).
o Transport Layer:
▪ Operates end-to-end over a network involving multiple intermediate routers.
2. Addressing:
o Data Link Layer:
▪ No need for explicit addressing; communication occurs directly between
connected devices.
o Transport Layer:
▪ Requires explicit addressing (e.g., IP and port numbers) to identify endpoints
across the network.
3. Connection Establishment:
o Data Link Layer:
▪ Simple and straightforward; the other endpoint is either reachable or not.
o Transport Layer:
▪ Complex due to the need to traverse the network and establish connections over
potentially varying routes and conditions.
4. Packet Behavior:
o Data Link Layer:
▪ Packets follow a fixed route and do not get lost or arrive out of order under
normal circumstances.
o Transport Layer:
▪ Packets may take different routes (in datagram-based networks like IP), leading
to delays, out-of-order delivery, or duplication.
5. Buffering and Flow Control:
o Data Link Layer:
▪ A fixed number of buffers can be allocated per line, as the environment is
predictable.
o Transport Layer:
▪ Must manage a large number of simultaneous connections with fluctuating
bandwidths, making static allocation impractical.
Key Challenges in the Transport Layer
5.2.1 Addressing
The establishment of connections between application processes in the transport layer
introduces several concepts, mechanisms, and solutions to efficiently manage endpoint
communication. Here’s a breakdown of the key ideas and procedures described:
How a user process in host 1 establishes a connection with a mail server in host 2 via a process server.
This excerpt explains the challenges of establishing reliable network connections, focusing on the
issue of delayed and duplicate packets. The key challenges and solutions are summarized below:
Challenges
1. Delayed Packets:
o Packets can take varying amounts of time to traverse the network, leading to
scenarios where old packets arrive after the connection has already been terminated
or replaced.
2. Duplicate Packets:
o In cases of retransmissions due to timeouts, multiple copies of the same packet can be
generated. If delayed duplicates are mistakenly treated as new packets, this can lead
to unintended actions, such as duplicate bank transactions.
3. Packet Lifetime:
o Networks cannot guarantee that packets disappear after a certain time. Without
proper mechanisms, old packets might interfere with new connections.
4. Resource Limitations:
o Maintaining extensive history for all previous connections (to check duplicates) is
impractical, as it requires indefinite memory retention by network entities.
(a) Segments may not enter the forbidden region. (b) The resynchronization problem.
Solutions
1. Restricting Packet Lifetime:
o Hop Counter: Each packet carries a counter that decrements at every hop; packets are
discarded when the counter reaches zero.
o Timestamping: Packets include their creation time, and routers discard packets older
than a certain threshold.
o Restricted Network Design: Enforces limits on how long a packet can circulate in the
network, though this can be difficult in large, distributed systems.
2. Unique Identifiers:
o Each connection or packet is labeled with a unique identifier, ensuring duplicates can
be recognized and discarded.
o Ensuring sequence numbers do not repeat within the packet lifetime is critical.
3. Clock-Based Sequence Numbers:
o Sequence numbers are derived from a clock that continues running even if the host
crashes. This prevents reuse of old sequence numbers.
4. Three-Way Handshake:
o A reliable protocol to establish connections while preventing interference from
delayed duplicates:
1. Step 1: The initiating host sends a connection request with an initial sequence
number.
2. Step 2: The receiving host replies with an acknowledgment and its own
sequence number.
3. Step 3: The initiating host sends a final acknowledgment.
o If a delayed duplicate request arrives, it is rejected because the sender and receiver
do not confirm the connection.
5. TCP Improvements:
o PAWS (Protection Against Wrapped Sequence Numbers): Prevents sequence number
wrapping within the maximum packet lifetime by extending sequence numbers with
timestamps.
o Pseudorandom Sequence Numbers: Ensures unpredictability of sequence numbers to
enhance security and prevent attacks.
Key Takeaways
• Reliability in connection protocols requires not only handling common scenarios efficiently
but also robust mechanisms to deal with edge cases like delayed and duplicate packets.
• Techniques like sequence numbering, packet lifetime restrictions, and three-way handshake
are foundational to modern networking protocols, including TCP.
• While additional security measures like pseudorandom sequence numbers have been
implemented to prevent attacks, the underlying principles ensure robustness against
network anomalies.
Three protocol scenarios for establishing a connection using a three-way handshake. CR denotes
CONNECTION REQUEST. (a) Normal operation. (b) Old duplicate CONNECTION REQUEST appearing out of
nowhere. (c) Duplicate CONNECTION REQUEST and duplicate ACK.
5.2.3 Connection Release
Releasing a connection is more complex than establishing one, with two main approaches:
asymmetric release (one party disconnects unilaterally, potentially causing data loss) and
symmetric release (each side releases its connection independently). While symmetric
release is safer, it works best when each side knows when it's done sending data.
The Two-Army Problem demonstrates the difficulty in synchronizing disconnections, where
unreliable communication channels lead to uncertainty and failure. Despite attempts at
protocols like a three-way handshake, it's proven that no perfect protocol exists for
mutual synchronization.
To handle this, practical solutions include using timers and retransmission mechanisms to
manage disconnection. In cases of lost messages, timers prevent indefinite waiting, and
after a certain number of retries, the connection is released. However, this can lead to
half-open connections (where one side believes the connection is closed, but the other
side does not). This issue is resolved by introducing rules like automatic disconnection
after inactivity, avoiding the need for endless retries.
Ultimately, the transport layer alone cannot solve connection release issues, and application
layers must be involved. Web servers often use abrupt closures (asymmetric close) based
on their predictable data exchange patterns, while other scenarios require more careful
coordination between both sides to ensure proper termination.
Four protocol scenarios for releasing a connection. (a) Normal case of three-way handshake. (b) Final ACK
lost. (c) Response lost. (d) Response lost and subsequent DRs lost.
5.2.4 Error Control and Flow Control
In the transport layer, error control and flow control are key mechanisms that ensure reliable data
delivery and prevent congestion. These mechanisms are similar to those in the data link layer, but with
important differences in function and scope. Here's an overview:
Error Control
The transport layer error control uses mechanisms like checksums and retransmissions, similar to the link
layer. However, the transport layer checksum is end-to-end, meaning it protects data across the entire
path between sender and receiver, unlike the link layer's checks, which protect data only across individual
links. This is crucial because errors can occur in routers or other intermediate points, which would not be
detected by link-layer checks. This concept aligns with the end-to-end argument, which suggests that
certain types of error detection should be handled at the endpoints of a communication, rather than on
every intermediate link.
Flow Control
Flow control ensures that a fast sender does not overwhelm a slower receiver. At the transport layer, this
is typically achieved through a sliding window protocol. In scenarios with high bandwidth and long
delays (like TCP connections), the sender may need to manage a larger buffer window to prevent stalling
and maximize throughput. This dynamic buffer management can be adjusted based on the network's
capacity to handle the traffic, not just the receiver's buffer space. Buffer space may be allocated
dynamically, allowing the receiver to adjust its capacity as needed.
Buffer Management
Dynamic buffer allocation is a critical aspect, especially for high-bandwidth traffic. The sender requests
buffers from the receiver, and the receiver grants as many as it can handle. This approach helps to adjust
for variations in traffic and network conditions. In contrast to a fixed window size, where buffer space is
allocated statically, dynamic allocation allows for more flexibility. For instance, TCP uses a window size
field in its header to manage this.
Congestion Control
When buffer space is not the limiting factor, network congestion can become the bottleneck. Belsnes
(1975) proposed a dynamic sliding window mechanism to adapt the sender's window size based on the
network's carrying capacity. This helps in maintaining a balance between the sender's rate of transmission
and the network's ability to handle the traffic, preventing congestion and ensuring smooth data flow.
This approach is especially useful in wide-area networks, where the available bandwidth may fluctuate,
necessitating adjustments in the sender's transmission rate. TCP and other transport protocols implement
similar congestion control mechanisms, dynamically adjusting the window size based on network
conditions.
These techniques ensure that data is delivered reliably and efficiently while minimizing the risk of
congestion or buffer overflow.
• When the internet was small, mapping was done by using a host file.[two
columns-names and address-host store it-update periodic]
• Today it is impossible, bcoz the host file would be too large and updating
problem.
• The solution is to maintain in one computer and allow centralized access[huge
traffic]
• Huge information divided into small parts today and stored different
computer.[host can contact the closest computer holding the needed
information.[method used by DNS]
Name space
• It is unambiguous, the name assigned to machines must be unique.
• Name space map each address to a unique name in two ways.
• Flat Name space
• Hierarchical Name Space.
Flat Name Space:
✓ A name in this space is a sequence of characters without structure.
✓ A name may (or) may not have a common section.[it has no meaning].
✓ It cannot be used in internet.[duplication].
Domain Name
• A full domain name is a sequence of labels separated by dots.
• The domain names are always read from the node up to the root.
• Finally, it end with null(root node)
Domain
• A domain is a subtree of the domain name space.
• The name of the domain is the domain name of the node at the top of the subtree.
Root server
• A root server is a server, whose zone consists of the whole tree.
• A root server usually does not store any information but authority to other servers.
Primary server and secondary servers
• DNS defines two types of servers:
• A primary server -stores a file about the zone, responsible for creating , maintaining,
and updating the zone file.
• A secondary server – that transfers the complete information about a zone from
another server and store the file on its local disk.
Generic domains
• It define registered hosts according to their generic behaviour.
EMAIL (SMTP, MIME, IMAP, POP)
1. One of the most popular Internet services is electronic mail (E-mail).
2. Email is one of the oldest network applications.
3. When the sender and the receiver of an e-mail are on the same system, we need only
two User Agents and no Message Transfer Agent
4. When the sender and the receiver of an e-mail are on different system, we need two UA,
two pairs of MTA (client and server), and two MAA (client and server).
1. When Alice needs to send a message to Bob, she runs a UA program to prepare the
message and send it to her mail server.
2. The mail server at her site uses a queue (spool) to store messages waiting to be sent.
3. The message, however, needs to be sent through the Internet from Alice’s site to Bob’s
site using an MTA.
4. Here two message transfer agents are needed: one client and one server.
5. The server needs to run all the time because it does not know when a client will ask for a
connection.
6. The client can be triggered by the system when there is a message in the queue to be
sent.
7. The user agent at the Bob site allows Bob to read the received message.
8. Bob later uses an MAA client to retrieve the message from an MAA server running on the
second server.
Command driven
1. Command driven user agents belong to the early days of electronic mail.
2. A command-driven user agent normally accepts a one character command from the
keyboard to perform its task.
3. Some examples of command driven user agents are mail, pine, and elm.
GUI-based
1. Modern user agents are GUI-based.
2. They allow the user to interact with the software by using both the keyboard and the
mouse.
3. They have graphical components such as icons, menu bars, and windows that make the
services easy to access.
4. Some examples of GUI-based user agents are Eudora and Outlook.
Multipurpose Internet Mail Extension (MIME)
standard that extends the functionality of Internet email to support multimedia content such as
text in character sets other than ASCII, attachments, images, audio, and video. MIME is also used
in other Internet protocols like HTTP to define the type of content being transmitted.
Key Features of MIME
1. Content Type Identification:
o MIME identifies the type of content using MIME types (e.g., text/html,
image/jpeg).
2. Multimedia Support:
o Supports a wide range of content types beyond plain text, including images,
audio, video, and application data.
3. Encoding Binary Data:
o Allows binary data to be encoded into a format suitable for transport over text-
based protocols.
4. Email Attachments:
o Provides a way to include attachments in emails.
5. Multipart Messages:
o Enables the inclusion of multiple types of content in a single email, such as text
and images.
Multipurpose Internet Mail Extensions (MIME) is a standard that extends the functionality of
Internet email to support multimedia content such as text in character sets other than ASCII,
attachments, images, audio, and video. MIME is also used in other Internet protocols like HTTP
to define the type of content being transmitted.
• This system allows document search and retrieval from any part of the Internet.
• A document can contain text, images, sound and video, together called Hypermedia.
Proxy Server
• A Proxy server is a computer that keeps copies of responses to recent requests.
1. The web client sends a request to the proxy server.
2. The proxy server checks its cache.
3. If the response is not stored in the cache, the proxy server sends the request to the
corresponding server.
1. Incoming responses are sent to the proxy server and stored for future requests from
other clients.
2. The proxy server reduces the load on the original server, decreases traffic, and improves
latency.
3. However, to use the proxy server, the client must be configured to access the proxy
instead of the target server.
4. The proxy server acts as both server and client.
5. When it receives a request from a client for which it has a response, it acts as a server
and sends the response to the client.
6. When it receives a request from a client for which it does not have a response, it first
acts as a client and sends a request to the target server.
7. When the response has been received, it acts again as a server and sends the response to
the client.
Audio and Video Streaming
Audio File Features
• Audio file is a record of captured sound that can be played back
• e.g. .WAV File
• Audio files are compressed for storage or faster transmission
• Requires high bandwidth to transfer across the network
Audio Streaming Concept
Video Streaming
• The object is to overcome the negative effects of physical distance and network
technology limitation.
Streaming Advantages
• Reduce setup time
• Reduction in client storage requirement
• Video can be viewed in real time
• Transmission signals over low bandwidth facilities
Video Streaming Architecture
• Content Creation/Capture
• Content Management
• Content Formatting (Compression)
• Delivery
• Distribution
• Presentation (Viewing)
• View Control
Video Capture
• Converting analog to video signals
• A special video capture card to convert the analog signals to digital form and
compresses the data.
• Also digital video devices that can capture images and transfer to a computer
Content Management
• Critical in video server
• The purpose including create, collect, catalog, organize, store, and access to massive
multimedia information database
Video Input Formats
• AVI
• ActiveMovie
• Cinepak
• Indeo
• motion-JPEG
• MPEG
• QuickTime
• RealVideo
• Video for Windows
• XGA