Professional Documents
Culture Documents
9/6/2016
Application Layer
There are too many applications to list here, just to name a few: email, VoIP, youtube,
Netflix, online gaming, Facebook, Twitter, Skype, Google, P2P file sharing, World
Wide Web, etc.
Client-Sever Architecture
The client process of the application makes requests (such as request for a file or web
page) to the server process
1 of 21
9/6/2016
Application Layer
The server process of the application fulfils the requests (such as sending the requested
file or web page to the client) of the client process
Examples of client-server applications are web, email, remote login, file transfer, etc.
Example. A web browser (the client process) resides on a PC at home and the web
server (the server process) resides in a powerful computer in a data center; the client
process and server process exchange messages over the HTTP protocol
Though it is possible both the server and client processes reside in the same computer
Client and server process are simply referred as client and server
Servers are always on because it has to satisfy requests made by many clients at
different times
Clients are running only when the users execute the client software
Communications are between clients and a server, but not between clients
For example, we do not have two browsers talking to each other
A single-server computer is often incapable of keeping up with all the requests from
clients so that a data center, housing a large number of computers each running a copy
of the server, to create a powerful virtual server. The Google client-server search
application has huge data centers housing thousands to tens of thousands of computer
2 of 21
9/6/2016
Application Layer
A servers IP address uniquely identify, to the network the computer that runs the
server
The network layer uses the IP address for forwarding the packets generated by clients
to the server
If server IP address is not fixed, clients would not know how to contact the computer
that runs the server software and the network layer would not know how to forward the
client packets to the server
Typically, users enter the URL (where the domain name is part of it) instead of the IP
address
It is the responsibility of the applications to resolve the domain name of the server to
the IP address of the server
3 of 21
9/6/2016
Application Layer
Servers can be clustered, called server farm or data center, to handle high volume of
client requests
Multiple instances of server software are running in different computers which are
connected together to form a high capacity virtual server
A peer computer is running both the client and server software. BitTorrent is an
example of P2P application
A peer can request files, send files, query to find where a file is located, respond to
queries, and forward queries
4 of 21
9/6/2016
Application Layer
Millions of peers may participate in the file sharing community, with each one
functioning as a server and contributing resources to the community
5 of 21
9/6/2016
Application Layer
Socket
When you browse a web page, the browser application sends web request messages to
the transport layer with the hope that the messages will reach the web server across the
Internet network
Sending message into the transport layer means calling the socket residing in the
transport layer
Socket is the interface between the application layer and transport layer which is an
API (Application Programming Interface) written in the transport layer and reside in
the transport layer library
Application developers do not write sockets in their application software
There are two type of sockets, namely, transmit socket and receive socket
An application process sends messages into the network through on side of a transmit
socket and assumes there is a transport infrastructure on the other side of the socket
Application developers have full control on the application layer side of the socket but
have little control of the transport layer side of the socket
The control that an application has on the transport layer side of the socket includes the
destination IP address, choice of transport protocol (whether it is TCP or UDP), TCP
6 of 21
9/6/2016
Application Layer
or UDP socket number, and transport layer related parameters such as maximum buffer
size, maximum segment lengths, port number, etc.
When an application is first started in a host, the application starts the receive socket
thread listening for any receiving messages
Depending on the implementation, either polling or interrupt can be used to read the
messages available from the receive socket
When a network application has a message to send, it calls a transmit socket and
provides with the socket, among other parameters, the socket number and the message
When the destination transport layer has a message for the application layer, it deposits
the message in the receive socket whose number matches messages socket number
7 of 21
9/6/2016
Application Layer
Management Protocol) message, and whether it is a get, post, head, put, or delete in
HTTP messages
The type of messages is identified by a fixed field in the messages. Knowing the type
of the message, the rest of the message is interpreted accordingly
Defines how the fields are interpreted (i.e., the semantics of fields or the meaning of
the fields)
Example 1: From: alice@crepes.fr in a SMTP message is interpreted as the sender of
the message
8 of 21
9/6/2016
Application Layer
Example 2: Get /somedir/page.html HTTP/1.1 is interpreted as a request for a web
page called page.html sent using HTTP version 1.1
Defines the rules for determining when and how a process sends messages and
responds to messages
Example 1 (when): A SNMP process may send a trap message to the management
station when an alarm threshold is crossed
Example 2 (how): The mail server process may respond to a received mail with
forwarding of the mail to the intended recipient
You can find many of the application layer protocols specifications in RFCs (Request
For Comments) which are in the public domain
Go to the www.ietf.org website for these RFCs (ietf means Internet Engineering Task
Force)
For example, the Webs application-layer protocol, HTTP (the HyperText Transfer
Protocol [RFC 2616]), is available as an RFC. If a browser developer follows the rules
of the HTTP RFC, the browser will be able to retrieve web pages from any web server
that has also followed the rules of the HTTP RFC
9 of 21
9/6/2016
Application Layer
Many other application-layer protocols are proprietary and intentionally not available
in the public domain. For example, Skype uses proprietary application-layer protocols
To identify the receiving application process, the sending application process must
specify:
(1) IP address or URL name of the destination host
IP addresses are 32 bits (version 4) or 128 bits (version 6) which is globally unique
If instead URL is specified, URLs domain name is looked up, using the Domain Name
Service (DNS), for the corresponding IP address
The lookup for the IP address is necessary because routers use IP address, not URL
name, for forwarding packets to their destinations
Domain names are universally unique and must be registered with government
authorized registrars; an example of registrar is Network Solution Inc.
(2) TCP or UDP port number of the receiving process in the destination host
The network layer process at the destination host directs the received segments to the
transport layer processes
10 of 21
9/6/2016
Application Layer
The transport layer process at the destination host directs the processed messages to the
application layer processes via the receive sockets corresponding to the port numbers
of the messages
You can find the list of well known applications and their port numbers from iana
website (www.iana.org); IANA stands for Internet Assigned Numbers Authority
Four services that applications expect from the lower layers: reliable data transfer,
bandwidth, timing, and throughput
Review Questions:
1.
9/6/2016
Application Layer
2.
For a communication session between two hosts, which is the client and which is
the server
Answer: The host that initiates the communication session is the client
3.
4.
List the various network-application clients that you use on a daily basis.
Answer: You probably use a browser and a mail reader on a daily basis. You may
also use an FTP user agent, a Telnet user agent, an audio/video player user agent
(such as a Real Networks player), an instant messaging agent, a P2P file-sharing
agent, etc.
5.
Why do HTTP, FTP, and SMTP protocols run on top of TCP rather than UDP?
Answer: The applications that use those protocols require that all application
data is received in the correct order and without gaps. TCP provides this service
whereas UDP does not
12 of 21
9/6/2016
Application Layer
HTTP (HyperText Transfer Protocol)
When a user requests an object from a web page (for example, clicks on a hyperlink),
the browser sends HTTP request messages for the objects in the page to the server. The
server receives the requests and responds with HTTP response messages that contain
the objects
HTTP is stateless because if a web browser requests the same object from the web
server back-to-back multiple times, the web server will respond to all the requests with
the requested object
Each time a web browser makes a request to a web server, a TCP connect will be
established first and the HTTP messages are transported over the TCP connection
Example: Suppose the home page of memphis.edu consists of a based HTML file and
ten JPEG images all of which are located on the same memphis.edu web server. The
ten JPEG images are referenced in the HTML file
13 of 21
9/6/2016
Application Layer
1.
A user attempts to open the home page of memphis.edu via a web browser by
typing http://www.memphis.edu
2.
The web browser attempts to contact the memphis.edu web server by first
initiating a TCP connection to memphis.edu, with a default TCP port number 80
3.
After the TCP port is opened successfully, the web browser sends a HTTP request
message to memphis.edu via the socket associated with the TCP connection that
was established in step 2. The request message contains the URL http://
www.memphis.edu
4.
The web server receives the request message via the socket associated with the
TCP connection, retrieves the default home page object /home.index (a HTML
file) from the hard drive, encapsulates the HTML file in a HTTP response
message, and sends the response message to the requester (web browser) via the
opened socket at the server side
5.
The web server then tells the transport layer to close the TCP connection. After
successful transfer of the response message to the web browser, the peer transport
layers tear down the TCP connection
14 of 21
9/6/2016
Application Layer
6.
The web browser receives the response message, extracts the HTML file from the
response message, examines the HTML files, and finds references to the ten JPEG
objects
7.
Steps 2 to 5 are repeated ten times, one for each JPEG image download
8.
Upon receiving a JPEG image, the web browser displays it on the screen
How a web browser displays, on the screen, the information received over the HTTP
connections is independent of HTTP
Different browsers may interpret a web page differently and may also display the web
page on the screen differently
HTTP protocol only specifies the how the client and server communicate, not how the
client and server use the communicated information
In nonpersistent HTTP connection, the client and server exchange exactly one request
message and one response in a TCP connection and hence 11 TCP connection setup
and tear down are required to transport 11 objects from server to client
Since web servers are multi-thread systems, multiple TCP connections can be opened
and existed at the same time
15 of 21
9/6/2016
Application Layer
Multi-thread allows more than one process to take place simultaneously in the
computer system (actually the processes are time sharing the CPU cycles)
Nonpersistent HTTP connections burdens the server CPU and suffers large delays
16 of 21
9/6/2016
Application Layer
Persistent HTTP Connections
The server leaves the TCP connection open and closes the connection only after the
connection has been idle for a certain amount of time, called the connection time-out.
The time-out value is typically configurable
HTTP client can issue multiple requests back-to-back without waiting for the receipt of
responses from the previous requests
Upon receiving back-to-back requests, the HTTP server sends the requested objects
back-to-back to the requester
With pipelining one RTT may expend multiple objects (that is during one RTT,
multiple objects may be in transit to the client). As a result, the duration of the opened
TCP connection is reduced
HTTP client issues a new request only when the response from the previous message
has been received
Since one RTT per request/receive of one object, k RTTs for request/receive of k
objects
17 of 21
9/6/2016
Application Layer
In the above example, ten RTTs delay is required to complete downloading ten JPEG
images
The sequential transfer of objects over the opened TCP connection will keep the
connection open for a longer period of time when compared to pipelining
Since the server consumes resource for maintaining opened TCP connections, more
resource will be consumed without pipelining (compared to pipelining)
Note that one object is sent from the web server to the client per request / response
transaction in all methods, persistent or nonpersistent with or without pipelining
Cookies
A mechanism, specified in rfc 2109, that enables a server to keep track of users
activities
Commercial web sites, such as ebay, yahoo, Amazon, etc., use cookies to track user,
activities, habits, preferences, and history
Cookies has four components: (1) a cookie header line in HTTP response message, (2)
a cookie header line in HTTP request message, (3) a cookie file kept on the users
computer, and (4) a back-end database at the web site
18 of 21
9/6/2016
Application Layer
Example:
A user browses a cookie enabled e-commerce web site the first time (no entry in the
users cookie file that corresponds to the web site being visited)
The browser sends a GET request message for the web sitess home page
Upon receiving the GET request message, the server creates a unique id and an entry in
the back-end database indexed by the id
The server responds to the request message with a Set-cookie header line which
contains the newly created id
An example of Set-cookie header line in a response message: Set-cookie: 1234567
Upon receiving the response message and seeing the Set-cookie header line, the
browser appends a line, that matches the cookie id with the URL of the web site, in the
cookie file
Thereafter, the web browser includes this cookie id in a cookie header line in all the
request messages sent to the web site
Every time a request message need to be sent, the browser tries to look up in the cookie
file the cookie id, indexed by the URL
If there is a match, the web browser adds a cookie header line with the looked up
cookie id value, in the request message
19 of 21
9/6/2016
Application Layer
Web Caching
A Web cachealso called a proxy serveris a network entity that satisfies HTTP
requests on the behalf of an origin Web server
The Web cache has its own disk storage and keeps copies of recently requested objects
in this storage
A users browser can be configured so that all of the users HTTP requests to a
particular web server are first directed to the Web cache
The browser establishes a TCP connection to the Web cache and sends an HTTP
request for the object to the Web cache
2.
The Web cache checks to see if it has a copy of the object stored locally. If it does,
the Web cache returns the object within an HTTP response message to the client
browser
3.
If the Web cache does not have the object, the Web cache requests it from the
original server (as if the browser is requesting the object from the original server).
After receiving this request, the origin server sends the object to the Web cache.
20 of 21
9/6/2016
Application Layer
4.
When the Web cache receives the object, it stores a copy in its local storage and
sends a copy to the client browser (over the existing TCP connection between the
client browser and the Web cache)
As you can see the Web cache is both a server and a client at the same time
A Web cache can substantially reduce the response time for a client request,
particularly if the bottleneck bandwidth between the client and the origin server is
much less than the bottleneck bandwidth between the client and the cache
Web caches can substantially reduce traffic on an institutions access link to the
Internet
21 of 21