0% found this document useful (0 votes)
23 views

Chapter 2 Application Layer

Hello

Uploaded by

ridoyh541
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)
23 views

Chapter 2 Application Layer

Hello

Uploaded by

ridoyh541
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
You are on page 1/ 64

Chapter 2

Application Layer

Tanjia Chowdhury
Assistant Professor
Southern University Bangladesh
Application Layer
The application layer in the OSI model is the closest layer to
the end user which means that the application layer and end
user can interact directly with the software application. The
application layer programs are based on client and servers.
The Application layer includes the following functions:
• Identifying communication partners: The application
layer identifies the availability of communication partners
for an application with data to transmit.
• Determining resource availability: The application layer
determines whether sufficient network resources are
available for the requested communication.
• Synchronizing communication: All the communications
occur between the applications requires cooperation which
is managed by an application layer.
Chapter 2: outline

2.1 Principles of network applications


2.2 Web and HTTP
2.3 FTP
2.4 Electronic mail :SMTP, POP3, IMAP
2.5 DNS
2.6 P2P applications
2.7 socket programming with UDP and TCP
2.1 Principles of network applications
Some network apps
• E-mail
• The web
• Text messaging
• Remote login
• P2P file sharing
• Multi-user network games
• Streaming stored video
(YouTube, Hulu, Netflix)
• voice over IP (e.g., Skype)
• Real-time video conferencing
Network Application Architecture

Application architecture is different from the network


architecture. The network architecture is fixed and
provides a set of services to applications. The
application architecture, on the other hand, is designed
by the application developer and defines how the
application should be structured over the various end
systems.
Application architecture is of two
types:
• Client-server architecture: An
application program running on
the local machine sends a request
to another application program is
known as a client, and a program
that serves a request is known as
a server.
For example, when a web server
receives a request from the client
host, it responds to the request to
the client host.
Characteristics Of Client-server
architecture:
• In Client-server architecture, clients do not directly
communicate with each other. For example, in a web
application, two browsers do not directly communicate with
each other.
• A server is fixed, well-known address known as IP address
because the server is always on while the client can always
contact the server by sending a packet to the sender's IP
address.
Disadvantage Of Client-server architecture:
• It is a single-server based architecture which is incapable of
holding all the requests from the clients. For example, a
social networking site can become overwhelmed when there
is only one server exists.
P2P (peer-to-peer) architecture:
It has no dedicated server in a data center. The peers are
the computers which are not owned by the service
provider. Most of the peers reside in the homes, offices,
schools, and universities. The peers communicate with
each other without passing the information through a
dedicated server, this architecture is known as peer-to-
peer architecture. The applications based on P2P
architecture includes file sharing and internet telephony.
Features of P2P architecture

• Self scalability: In a file sharing system, although


each peer generates a workload by requesting the
files, each peer also adds a service capacity by
distributing the files to the peer.
• Cost-effective: It is cost-effective as it does not
require significant server infrastructure and server
bandwidth.
Processes communicating
Client and Server processes
• A network application consists of a pair of processes
that send the messages to each other over a network.
• In P2P file-sharing system, a file is transferred from a
process in one peer to a process in another peer. We
label one of the two processes as the client and
another process as the server.
• With P2P file sharing, the peer which is downloading
the file is known as a client, and the peer which is
uploading the file is known as a server. However, we
have observed in some applications such as P2P file
sharing; a process can be both as a client and server.
Therefore, we can say that a process can both
download and upload the files.
Sockets

• A process sends/receives messages to/from the


network through its socket
Example
• A process is analogous to a house & its socket is
analogous to its door
• sending process shoves message out door
• sending process relies on transport infrastructure
on other side of door to deliver message to
socket at receiving process
API(application programming
interface)
• The control that Application developer has on
the transport–layer side is
1) The choice of transport protocol
2) Ability to fix a few parameters like maximum
buffer and maximum segment sizes
Addressing processes
To identify the receiving process, two pieces of
information need to be specified.
i) The name or address of the host
ii) An identifier that specifies the receiving process in
the destination host.
• identifier includes both IP address and port numbers
associated with process on host.
• host device has unique 32-bit IP address
Example port numbers:
• HTTP server: 80
• mail server: 25
App-layer protocol
• An application layer protocol defines:
Web and HTTP
HTTP
• The Hypertext Transfer Protocol (HTTP) is an
application-level protocol that uses TCP as an
underlying transport and typically runs on
port 80. HTTP is a stateless protocol i.e. server
maintains no information about past client
requests.
HTTP Connections
• Non-Persistent
• Persistent
Features of HTTP:
• Connectionless protocol: HTTP is a connectionless protocol. HTTP client
initiates a request and waits for a response from the server. When the
server receives the request, the server processes the request and sends
back the response to the HTTP client after which the client disconnects the
connection. The connection between client and server exist only during the
current request and response time only.

• Media independent: HTTP protocol is a media independent as data can be


sent as long as both the client and server know how to handle the data
content. It is required for both the client and server to specify the content
type in MIME-type (Multipurpose Internet Mail Extensions) header.

• Stateless: HTTP is a stateless protocol as both the client and server know
each other only during the current request. Due to this nature of the
protocol, both the client and server do not retain the information between
various requests of the web pages.
HTTP overview
HTTP connections
Http 1.0 is a non-persistent connection, and http 1.1 is persistent
connection.
Basic Pre-Requisite
The terminology which we must know before going deep into Persistent & Non-Persistent
Connections is
1.RTT(Round Trip Time)
2.TCP 3-Way Handshake
1. RTT: Time for a small packet to travel from client to server and back.
RTT = 2 X propagation time
1. For a connection Persistent or Non-persistent it is sure that to initiate a TCP connection one
RTT is used.
2. One RTT is used for the HTTP request and the first few bytes to the HTTP response to return.
So to know the total file transmission time.
Total = 2RTT + transmit time
2. TCP 3-Way Handshake: TCP Connection establishes in 3 ways, that’s why it is called a 3-
way Handshake.
•Requesting the server for the connection.
•The server responds to whether the connection can be established or not.
•Acknowledgment by the client on the response sent by the server.
Round trip time(RTT)
Persistent HTTP does not require 2 RTT (round trip time) for each object that is to be
transmitted. After a successful opening of the TCP connection (opening of TCP
connection is done by 3-Way Handshaking which takes 1 RTT),
each object will require only 1 RTT to be transmitted.
HTTP request message
• two types of HTTP messages: request,
response
• HTTP request message: ASCII (human-
readable format)
General format of an HTTP request
message
Request-Line
• The Request-Line begins with a method token, followed by the
Request-URI and the protocol version, and ending with CRLF. The
elements are separated by space SP characters.
Request Method
• The request method indicates the method to be performed on the
resource identified by the given Request-URI.
Request-URl
• The Request-URI is a Uniform Resource Identifier and identifies the
resource upon which to apply the request.
Request Header Fields
• The request-header fields allow the client to pass additional
information about the request, and about the client itself, to the
server. These fields act as request modifiers.
General format of an HTTP response
message
Message Status-Line
• A Status-Line consists of the protocol version followed by a numeric status code
and its associated textual phrase. The elements are separated by space SP
characters.
HTTP Version
• A server supporting HTTP version 1.1 will return the following version information:
HTTP-Version = HTTP/1.1
User-server state: cookies
Web caches (proxy server)
• goal: satisfy client request without involving
origin server
What is Web Caching?
Storing the data to reuse it whenever it is required again is
known as web caching similar to how a web server serves a
web page to a browser. When the user first visits the page
then that page will be stored/cached and when the user visits
the next page and requests for the same page then that copy
of the web page is served from the cache, which also helps in
reducing the overload of the origin server. The delivery speed
of the page is improved by the strategies and solutions of web
caching. As a result, the backend server work is also reduced.
For ensuring that the freshest content is available in the
cache, at specific time intervals caching servers are set to be
refreshed and caching servers are also refreshed in response
to some specific events.
How a Web Caching Work?
Your website resource copy is stored at a different place which is known as a web cache.
Web cache acts as an intermediate on the web. And the job of the web cache is to sit in
between the user and the origin server and it also saves the HTTP responses sent by the
server such as HTML documents, CSS files, images, videos, etc. Web-cached responses are
referred to as representations since the original website is represented by them at a
particular point in time. Requests sent by the browser for the resources are tracked by the
web caches and then it serves them to the client. So that's why for every request it is not
required to go to the origin server. If the requested resource is accessed from the cache
then we call it cache hit. On the other hand, if the requested resource is not accessed
from the cache means the cache is not able to fulfil the request of the resource then we
call it a cache miss. Mostly in every case, we want that there is a high cache hit ratio, high
cache hit ratio means most HTTP requests are retrieved from the cache and fulfilled by the
cache.
Proxy Servers Vs Web Caching

• The proxy server will behave as an intermediate between the


server and the client and caching server is the proxy server
sub-type. Transaction between the two is handled by the proxy
server and web caching stores the data locally which is
accessed from the WAN so that we do not require to go to the
WAN next time and content is accessed from the cache.
Benefits of a Web Caching
• Reduction in Consumption of Bandwidth
• As web caching reduces the traffic on the network and decreases the congestion on the network that’s
why bandwidth is reduced.
• Server Workload Reduced
• The workload of the web server is reduced as the data is spread widely and stored in the proxy caches.
• Network Traffic Reduced
• Since we don't need to fetch all the data from the server, we can fetch frequently accessed data from the
cache, which reduces network traffic as every request won't go to the server.
• Reduction in the Transmission Delay
• Web caching reduces the transmission delay as documents that are accessed frequently are retrieved from
the nearby cache so we are not required to fetch frequently accessed documents from the remote data
servers.

Conclusion
• The proxy server is generally used to work as a Gateway between the internet and the user.
The proxy server is used as an intermediary server as it separates the end users from the
different websites they browse according to their requirements.
• Security and private browsing are some of the advantages of the proxy server.
• Storing the data to reuse it is known as web caching like a web server served web page is
stored.
• When the user first visits the page then that page will be stored/cached and when the user
visits the next page and requests for the same page then that copy of the web page is served
from the cache, which also helps in reducing the overload of the origin server.
• Reduced Server workload, reduced network traffic, and reduced bandwidth consumption are
the advantages of web caching.
FTP
•FTP stands for File transfer protocol.
•FTP is a standard internet protocol provided by TCP/IP used for transmitting
the files from one host to another.
•It is mainly used for transferring the web page files from their creator to the
computer that acts as a server for other computers on the internet.
•It is also used for downloading the files to computer from other servers.
Electronic mail
• Three major
components:
• user agents
• mail servers
• simple mail transfer
protocol: SMTP
• User Agent
“mail reader”
• composing, editing, reading mail messages
e.g., Outlook, Thunderbird, iPhone mail client
• outgoing, incoming messages stored on server
• The keyword smtp_crlf or smtp means that
lines must be terminated with a carriage
return (CR) line feed (LF) sequence.

You might also like