Professional Documents
Culture Documents
Lec 8 Application Layer
Lec 8 Application Layer
Sazia Sharmin
Lecturer
SWE, DIU
*
UNIT-5 : APPLICATION LAYER
Domain Name System
There are several applications in the application layer of the Internet model that follow
the client/server paradigm. The client/server programs can be divided into two
categories: those that can be directly used by the user, such as e-mail, and those that
support other application programs. The Domain Name System (DNS) is a supporting
program that is used by other programs such as e-mail.
Figure 25.1 shows an example of how a DNS client/server program can support an e-
mail program to find the IP address of an e-mail recipient.
*
UNIT-5 : APPLICATION LAYER
25.1 Name Space
The names must be unique because the addresses are unique. A name
space that maps each address to a unique name can be organized in two
ways: fiat or hierarchical.
Hierarchical Name
Flat Name
Space
Space
Each name is made of several parts. The
first part can define the nature ofthe
organization, the second part can define
A name is assigned to an
the name of an organiza-tion, the third
address. A name in this space is
part can define departments in the
a sequence of characters without organization, and so on.
structure.
*
UNIT-5 : APPLICATION LAYER
25.2 Domain Name Space
To have a hierarchical name space, a domain name space was
designed. In this design the names are defined in an inverted-tree
structure with the root at the top. The tree can have only 128
levels: level 0 (root) to level 127 (see Figure 25.2).
*
UNIT-5 : APPLICATION LAYER
Figure 25.1 Domain name space
Label
Each node in the tree has
a label, which is a string
with a maximum of 63
characters.
The root label is a null
string (empty string).
Domain Name
Each node in the tree has
a domain name. A full
domain name is a
sequence of labels Figure
25.3 shows some domain
names.
*
UNIT-5 : APPLICATION LAYER
Figure 25.4 Domains
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. Figure 25.5 shows some
domains. Note that a domain may itself be divided into domains (or subdomains
as they are sometimes called).
*
UNIT-5 : APPLICATION LAYER
25.3 Distribution of Name Spaces
DISTRIBUTION OF NAME SPACE
Root
● It is inefficient because responding to requests from all over the
Server
world places a heavy load on the system.
*
UNIT-5 : APPLICATION LAYER
Figure 25.5 Hierarchy of name servers
The solution to these problems is to distribute the information among many computers
called DNS servers.
*
UNIT-5 : APPLICATION LAYER
9
Figure 25.6 Zones and domains
*
UNIT-5 : APPLICATION LAYER
Note:
*
UNIT-5 : APPLICATION LAYER
25.4 DNS In The Internet
*
UNIT-5 : APPLICATION LAYER
Figure 25.8 Generic domains
*
UNIT-5 : APPLICATION LAYER
Table 25.1 Generic domain labels
Label Description
*
UNIT-5 : APPLICATION LAYER
Table 25.2 New generic domain labels
Label Description
*
UNIT-5 : APPLICATION LAYER
Figure 25.9 Country domains
*
UNIT-5 : APPLICATION LAYER
Figure 25.10 Inverse domain
*
UNIT-5 : APPLICATION LAYER
Figure 25.13 DNS MESSAGES (Query and response messages)
DNS has two types of messages: query and response. Both types have the same
format.
The query message consists of a header and question records; the response message
consists of a header, question records, answer records, authoritative records, and addi-
tional records
*
UNIT-5 : APPLICATION LAYER
Figure 25.14 Header format
Both query and response messages have the same header format with some
fields set to zero for the query messages. The header is 12 bytes, and its
format is shown in the Figure.
*
UNIT-5 : APPLICATION LAYER
Note:
*
UNIT-5 : APPLICATION LAYER
HTTP and WWW
The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data on
the World Wide Web. HTTP functions as a combination of FTP and SMTP. It is similar to
FfP because it transfers files and uses the services of TCP.
However, it is much simpler than FfP because it uses only one TCP connection. There is no
separate control connection; only data are transferred between the client and the server.
HTTP is like SMTP because the data transferred between the client and the server
look like SMTP messages. In addition, the format of the messages is controlled by
MIME-like headers. Unlike SMTP, the HTTP messages are not destined to be read by
humans; they are read and interpreted by the HTTP server and HTTP client (browser).
SMTP messages are stored and forwarded, but HTTP messages are delivered immedi-
ately. The commands from the client to the server are embedded in a request message.
The contents of the requested file or other information are embedded in a response
message.
Figure 27.12 illustrates the HTTP transaction between the client and server.
Although HTTP uses the services ofTCP, HTTP itselfis a stateless protocol. The
client initializes the transaction by sending a request message. The server replies
by sending a response.
*
UNIT-5 : APPLICATION LAYER Figure 27.1 HTTP transaction
Figure 27.2 Request message
Messages -> The formats of the request and response messages are similar; both
are shown in Figure 27.13. A request message consists of a request line, a header,
and sometimes a body.
*
UNIT-5 : APPLICATION LAYER
Figure 27.3 Request line
Request and Status Lines The first line in a request message is called a
request line; the first line in the response message is called the status line.
There is one common field, as shown in Figure 27.14.
*
UNIT-5 : APPLICATION LAYER
Figure 27.7 Header format
Header exchanges additional information between the client and the server.
For example, the client can request that the document be sent in a special format, or the
server can send extra information about the document. The header can consist of one or
more header lines. Each header line has a header name, a colon, a space, and a header
value
*
UNIT-5 : APPLICATION LAYER
25
Figure 27.8 Headers
*
UNIT-5 : APPLICATION LAYER
Example 1
This example retrieves a document. We use the GET method to
retrieve an image with the path /usr/bin/image1. The request line
shows the method (GET), the URL, and the HTTP version (1.1).
The header has two lines that show that the client can accept
images in GIF and JPEG format. The request does not have a body.
The response message contains the status line and four lines of
header. The header lines define the date, server, MIME version, and
length of the document. The body of the document follows the
header (see Fig. 27.9, next slide).
*
UNIT-5 : APPLICATION LAYER
Figure 27.9 Example 1
*
UNIT-5 : APPLICATION LAYER
Example 2
This example retrieves information about a document. We use the
HEAD method to retrieve information about an HTML document
(see the next section). The request line shows the method (HEAD),
URL, and HTTP version (1.1). The header is one line showing that
the client can accept the document in any format (wild card). The
request does not have a body. The response message contains the
status line and five lines of header. The header lines define the date,
server, MIME version, type of document, and length of the
document (see Fig. 27.10, next slide). Note that the response
message does not contain a body.
*
UNIT-5 : APPLICATION LAYER
Figure 27.10 Example 2
*
UNIT-5 : APPLICATION LAYER
Persistent Versus Nonpersistent Connection