0% found this document useful (0 votes)
33 views30 pages

Application Layer 1

Uploaded by

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

Application Layer 1

Uploaded by

fairykomal993
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 30

THE APPLICATION

LAYER
Computer Networking: A Top-Down Approach
OVERVIEW OF APPLICATION
LAYER
Definition: The Application Layer is responsible for providing end-user
services and enabling communication between software applications over
the network.
Main Tasks:
•Supports user-facing applications like web browsers, email clients, and file transfer
utilities.
•Defines how messages should be formatted, transmitted, and interpreted between
hosts.
Protocols:
• HTTP: Used for web browsing.
• DNS: Translates domain names to IP addresses.
• SMTP: Used for sending emails.
• FTP: Transfers files between computers.
NETWORK APPLICATION
ARCHITECTURES
 Network Application Architectures define how
applications interact and exchange data over a network. Two common
architectures are the Client-Server Model and the Peer-to-
Peer (P2P) Model.

 Client-Server Architecture
• Definition: In a client-server model, clients request services, and
the server responds by providing them. The server is a centralized
entity that handles all the processing and resource distribution.
NETWORK APPLICATION
ARCHITECTURES CONT…
Characteristics:
• Server: Always on, awaiting requests.
• Client: Requests services from the server.
• Scalability: Can be an issue as the server needs more resources to handle a
growing number of clients.
 Examples:

• Web Browsing: A browser (client) sends an HTTP request to a web server.


The web server (such as Apache or Nginx) processes the request and returns
the requested web page.
• Email (SMTP): The mail client sends a message to an SMTP server, which
then forwards it to the recipient's server.
NETWORK APPLICATION
ARCHITECTURES CONT…
Advantages:
• Centralized control over data and services.
• Easier to manage and enforce security since the server is the single point of
control.
• Reliability: Servers are typically robust and backed up with redundant
systems.
Disadvantages:
• Scalability issues: As client numbers increase, the server can become a
bottleneck.
• Cost: Maintaining high-powered servers is expensive.
• Single Point of Failure: If the server goes down, clients cannot access
the service.
NETWORK APPLICATION
ARCHITECTURES CONT…
Peer-to-Peer (P2P) Architecture
Definition: In P2P architecture, every node (peer) acts as both a client and
a server. Instead of relying on a central server, peers share resources directly
with each other
Characteristics:
•Peers communicate directly to share files, data, or resources.
•No centralized control; peers contribute and consume resources.
•Dynamic: Peers can join or leave the network at any time without major
disruption.
Examples:
• BitTorrent: File-sharing protocol where users download pieces of a file
from multiple peers simultaneously, rather than from a central server.
• Skype (originally): Used P2P architecture to distribute VoIP traffic
among peers, bypassing centralized servers for call routing.
NETWORK APPLICATION
ARCHITECTURES CONT.…
Peer-to-Peer (P2P) Architecture
 Advantages:

• Scalability: Resources increase as more peers join the network.

• Cost Efficiency: No need for centralized infrastructure (servers).

• Fault Tolerance: No single point of failure; if one peer disconnects, others can still
share resources.
 Disadvantages:

• Security: Difficult to secure and manage because there’s no centralized control


over what peers share.
• Performance Variability: As peer availability and bandwidth vary, the quality of
service can fluctuate.
NETWORK APPLICATION
ARCHITECTURES CONT…
Hybrid Architectures
• Some systems use a combination of client-server and P2P models to
benefit from both architectures.
• Example: Modern VoIP services like Zoom use a central server for
authentication and control but establish P2P connections for actual
voice or video transmission when possible.
Socket Programming:
• Programs (like web browsers or servers) use sockets to communicate
with other processes.
• The Socket API allows applications to create, use, and manage
sockets for network communication.
PROCESS
COMMUNICATION
 Process communication in networking refers to how two programs
(processes) on different devices communicate across a network to
exchange information. This involves sending and receiving data over a
network.
Sockets
Definition:
A socket is the interface between a process and the network that enables
communication. It is the endpoint for sending and receiving data across
the network.
PROCESS
COMMUNICATION CONT..
Socket Types:
• StreamSockets (TCP): Used for reliable, connection-oriented
communication (e.g., HTTP, FTP).
• Datagram Sockets (UDP): Used for connectionless, unreliable
communication (e.g., DNS, video streaming).
PROCESS
COMMUNICATION CONT..
Addressing in Process Communication
 For two processes to communicate, they need to know each other’s
address, which includes both the IP address and port number:
IP Address:
• Uniquely identifies a device (host) on the network.
• IPv4 (e.g., 192.168.1.1) and IPv6 (e.g.,
2001:0db8::85a3:0000:0000:8a2e:0370:7334) are used for identifying
devices.
PROCESS
COMMUNICATION CONT..
Port Numbers:
1. Identify specific applications or services running on a host.
2. Well-known Ports:
1. Port 80: HTTP (web traffic).
2. Port 443: HTTPS (secure web traffic).
3. Port 21: FTP.
3. Dynamic/Private Ports: Typically assigned by the OS for client
processess
Combination:
• The combination of an IP address and a port number is called a socket
address (or endpoint), which uniquely identifies where communication
should be directed.
• Example: 192.168.1.100:80 indicates an HTTP service (port 80) on the
device with IP 192.168.1.100
HOW PROCESSES
COMMUNICATE

1 Client-Server Interaction:
• The client process initiates communication by sending a request to the
server process using the server’s socket address (IP + port).
• The server listens on its socket for incoming requests and responds
accordingly.
2 TCP vs UDP for Process Communication:
• TCP (Transmission Control Protocol):
• Connection-oriented protocol, meaning a connection must be
established before data is sent.
• Ensures reliable delivery of data with error checking,
acknowledgments, and retransmission in case of data loss.
• Example: HTTP, FTP.

UDP (User Datagram Protocol):


1. Connectionless and unreliable, meaning data is sent without
establishing a formal connection, and packets can be lost or
received out of order.
2. Used in applications where speed is prioritized over reliability.
3. Example: DNS, live video streaming.
Socket API Functions (Examples)
1. Socket Creation:
Socket ( ): Creates a new socket for communication
2. Binding:
Bind( ): Binds the socket to an IP address and port
number.
3. Listening & Accepting:
• listen( ) : For server processes, it listens for incoming
client connections.
• accept( ): Accepts a client’s request to connect.
4. Sending and Receiving:
• send( ): Sends data from one process to another.
• receive ( ): Receives data from a connected process.
 Address Translation and DNS
• Domain Name System (DNS) translates human-readable
domain names (e.g., www.example.com) into IP addresses so that
processes can communicate with each other using an easily memorable
name.
• The DNS system facilitates addressing for process communication by
eliminating the need for users or applications to manage IP addresses
directly.
Connection Establishment (TCP): Uses a 3-way
handshake to establish a reliable connection:

1.SYN: The client sends a synchronization packet to the server.


2.SYN-ACK: The server responds with a synchronization
acknowledgment.
3.ACK: The client sends a final acknowledgment, and the connection
is established.

Connection Termination (TCP): Gracefully closes the


connection with a 4-step process (FIN, ACK) to ensure all data is
transferred.
HTTP - HYPERTEXT
TRANSFER PROTOCOL

Definition:
HTTP is a stateless, application-layer protocol used to transfer
hypertext documents on the web.

 HTTP Methods:
• GET: Requests data from a server.

• POST: Sends data to a server to create/update resources.

• PUT: Updates existing data on the server.

• DELETE: Removes resources from the server.


HTTP - HYPERTEXT
TRANSFER PROTOCOL
CONT..
Statelessness:
HTTP is a stateless protocol, it means that each time a client (like a web
browser) sends a request to a server, the server treats that request as a
completely new, independent event. The server doesn’t remember any
previous interactions with the client.
Example:
 Imagine you go to a coffee shop, order a coffee, and then leave. The next day, when you go
back to the same coffee shop, the barista doesn’t remember you or your previous order. You
have to tell them again what you want, even though you’ve been there before. Each visit is like
starting fresh.
 This is how HTTP works:

• When you load a webpage, your browser sends a request to the web server for the page.

• After the server sends the page back, it “forgets” everything about you. If you request another
page, the server treats it like a new request, with no memory of the previous one.
HTTP - HYPERTEXT
TRANSFER PROTOCOL
CONT..
How This Affects Websites:
• Without some way to remember you, the server wouldn’t know if you were
logged in or what items you added to your shopping cart.
• This is where cookies and sessions come in. They help websites keep track
of users even though HTTP itself doesn’t remember anything.
 In short, stateless means that the server doesn't remember anything
between requests unless extra mechanisms (like cookies) are used to
maintain session information.
Assignment HTTP Versions:
• HTTP/1.1: Persistent connections, chunked transfer encoding.
• HTTP/2: Multiplexing, header compression for improved speed.
• HTTP/3: Built on QUIC protocol, reducing latency and improving
reliability.
FTP - FILE TRANSFER
PROTOCOL
Definition: FTP is used to transfer files between a client and a server
over a TCP connection.
How it Works:
• Control Connection: Established for sending commands (port
21).
• Data Connection: Established separately for transferring data
(port 20).
Modes:
Active Mode: Client opens a port, and the server initiates the data
connection.
Passive Mode: Server opens a port, and the client initiates the
data connection.
FTP - FILE TRANSFER
PROTOCOL
Advantages:
Reliable file transfer with support for authentication.

Disadvantages:
Lacks encryption (unless FTPS or SFTP is used), making it vulnerable
to interception.
DNS - DOMAIN NAME
SYSTEM
Definition: DNS is a distributed hierarchical system that translates human-
readable domain names (e.g., www.example.com) into IP addresses (e.g.,
192.168.1.1)..
How DNS Works:
1. Local DNS Resolver:
A local DNS resolver (also known as a DNS client or stub resolver) is typically
part of the operating system of the user’s device. Its main job is to look up DNS
information.
Before making any requests to external DNS servers, it checks its local cache for
any recently resolved domain names.
If the domain name (e.g., example.com) is found in the cache, the resolver uses
the cached result, avoiding the need for a network request and reducing latency.
DNS - DOMAIN NAME
SYSTEM
2. Recursive Query:
• If the local DNS resolver does not have the domain information cached, it
performs a recursive query.
 This means the resolver queries other DNS servers on behalf of the user to find
the correct IP address associated with the domain name.
 It starts by contacting a root DNS server, then moves on to a TLD (Top-Level
Domain) server (e.g., for .com domains), and finally reaches the
authoritative DNS server that holds the correct IP address for the domain.
This process continues until the resolver gets the needed information, which is
then cached for future use.
PEER-TO-PEER
APPLICATIONS
Definition: In P2P applications, each user (peer) both consumes
and
provides resources.

Examples:

BitTorrent: Uses “P2P" to download and upload pieces of a file from multiple
peers simultaneously.
Skype: Initially used a P2P architecture for voice calls, allowing scalable and
decentralized connections.

Advantages:
• Highly scalable as resources grow with the number of users.

• Reduces reliance on central servers, lowering costs.


 Challenges:

• Security: Harder to control who accesses what resources.

• Performance: Can be unpredictable, as it depends on the availability of peers.


APPLICATION LAYER
PROTOCOLS
 SMTP (Simple Mail Transfer Protocol):

• Definition: Protocol for sending email between servers.


• Ports: SMTP typically uses port 25 for communication.
• Process: Pushes emails from client to mail server and between mail
servers.
 POP3 (Post Office Protocol 3):

• Definition: Used for retrieving email from a mail server.


• Characteristics: Downloads email from the server to the client and
deletes it from the server.
IMAP (Internet Message
Access Protocol)

• Definition: More flexible than POP3; allows email to be stored on


the server and accessed from multiple devices.
• Characteristics: Syncs email between devices without deleting it.
 Telnet/SSH:

• Telnet: Provides remote access to servers but transmits data in plain


text, making it insecure.
• SSH (Secure Shell): Secure alternative to Telnet, encrypting
data for secure remote access.
WEB CACHING
Definition: Web caching stores copies of frequently
accessed web content closer to the user to reduce latency
and improve performance
 Proxy Servers:

• Acts as an intermediary between users and the internet.


• Caches web content to speed up future requests.
 Cache Consistency:

• Challenge: Cached content might become outdated.


• Solution: Implement time-based validation (e.g.,
expiration dates) or content validation via HTTP headers.
TRANSPORT SERVICES
REQUIRED BY APPLICATIONS

 Reliability:

• Applications like email and file transfers require reliable transport (e.g.,
TCP), ensuring all data is received.
• Applications like real-time video may tolerate some data loss and use
unreliable transport (e.g., UDP).
 Throughput:

• Some applications need constant, high throughput (e.g., video


streaming).
• Others, like email, have less stringent throughput requirements.
TRANSPORT SERVICES
REQUIRED BY APPLICATIONS

 Timing:

• Real-time applications (e.g., VoIP, live video) need low latency.


• Non-real-time applications (e.g., file transfer) can tolerate higher
latency.

You might also like