Module 4part2 - Application - Layer
Module 4part2 - Application - Layer
Module 4
Part 2 : Application Layer
Subject In charge
Ms. Gigi Joseph
Assistant Professor
Room no. 404
Email:[email protected]
APPLICATION LAYER
APPLICATION LAYER
Application layer: -enables the user to access the network
-provides user interfaces and supports for services such as email, remote file
access and transfer , shared database management, and other types of
distributed information services
-Functions: - Network virtual terminal
- File transfer, access and management
- Mail services
- Directory services
Domain Name System translates Internet domain and host names to IP addresses and viceversa
Server
Namespace : A name space that maps each address to a unique name can be organized in two
ways: flat or hierarchical
Flat name space
- a name is assigned to an address
- name in this space is a sequence of characters without structure
- main disadvantage : it cannot be used in a large system such as the Internet because it must be
centrally controlled to avoid ambiguity and duplication
Hierarchical name space
- each name is made of several parts.
- first part can define the nature of the organization, the second part can define the name of an
organization, the third part can define departments in the organization, and so on.
- authority to assign and control the name spaces can be decentralized i.e. a central authority can
assign the part of the name that defines the nature of the organization and the name of the
organization. The responsibility of the rest of the name can be given to the organization itself. The
organization can add suffixes (or prefixes) to the name to define its host or resources.
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).
-DNS requires that children of a node (nodes that
branch from the same node) have different labels, which
guarantees the uniqueness of the domain names.
Domain Name :
-Each node in the tree has a 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.
-The last label is the label of the root (null). This means
that a full domain name always ends in a null label,
which means the last character is a dot because the null
string is nothing.
SIES Graduate School of Technology Computer Network and Network Design
Dept. of AIML 8
Ms. Gigi Joseph
The material in this presentation belongs to SIES Graduate School of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
Domain :
• a domain is a subtree of the domain name space.
• name of the domain - is the domain name of the node at the top of the subtree
• a domain may itself be divided into subdomains
A single point of failure : If the DNS server crashes, so does the entire Internet
Traffic volume : A single DNS server would have to handle all DNS queries (for all the HTTP
requests and e-mail messages generated from hundreds of millions of hosts).
Distant centralized database : A single DNS server cannot be “close to” all the querying clients. If
we put the single DNS server in New York City, then all queries from Australia must travel to the
other side of the globe, perhaps over slow and congested links. This can lead to significant delays.
Maintenance : The single DNS server would have to keep records for all Internet hosts. Not only
would this centralized database be huge, but it would have to be updated frequently to account for
every new host
Primary server –
• A primary server is a server that stores a file about the zone for which it is an authority.
• It is responsible for creating, maintaining, and updating the zone file. It stores the zone file on a
local disk.
Secondary server -
• A secondary server is a server that transfers the complete information about a zone from another
server (primary or secondary) and stores the file on its local disk.
• The secondary server neither creates nor updates the zone files.
Resolution :
Mapping a name to an address or an address to a name is called name-address resolution
DNS resolves domain names to IP addresses through a hierarchical and distributed system of DNS servers. The
process involves several steps:
1. DNS Query Initiation:
•When a user or application requests a domain name resolution (e.g., enters a URL in a web browser), the
local device initiates a DNS query to resolve the domain name to an IP address.
6. DNS Response:
•The recursive resolver receives the IP address from the authoritative DNS servers.
•It caches this information locally for future use and sends the IP address back to the requesting device.
•The device then uses this IP address to establish a connection to the desired server or resource associated
with the domain name.
• Number of answer records subfield : contains the number of answer records in the answer section
of the response message. Its value is zero in the query message.
• Number of authoritative records subfield : contains the number of authoritative records in the
authoritative section of a response message. Its value is zero in the query message.
• Number of additional records subfield : contains the number additional records in the additional
section of a response message. Its value is zero in the query message.
• Additional Information Section : This is a section consisting of one or more resource records. It is
present only on response messages. This section provides additional information that may help
the resolver. For example, a server may give the domain name of an authoritative server to the
resolver in the authoritative section, and include the IP address of the same authoritative server in
the additional information section
DNS can use either UDP or TCP - In both cases the well-known port used by the server is port 53.
UDP is used when the size of the response message is less than 512 bytes because most UDP
packages have a 512-byte packet size limit.
TCP connection is used, if the size of the response message is more than 512 bytes
In that case, one of two scenarios can occur:
If the resolver has prior knowledge that the size of the response message is more than 512
bytes, it uses the TCP connection. For example, if a secondary name server (acting as a client)
needs a zone transfer from a primary server, it uses the TCP connection because the size of the
information being transferred usually exceeds 512 bytes
If the resolver does not know the size of the response message, it can use the UDP port.
However, if the size of the response message is more than 512 bytes, the server truncates the
message and turns on the TC bit. The resolver now opens a TCP connection and repeats the
request to get a full response from the server
Electronic mail
• It is one of the most widely used features of the internet along with the web
• E-mail messages are usually encoded in ASCII text and uses multiple protocol within the
transport protocol/Internet protocol (TCP/IP)
• A popular protocol for sending e-mail is simple mail transfer protocol (SMTP) and for receiving
is post office protocol(POP3)
User agent : is a program that provides a graphical interface, or a text- and command-based interface
that lets users interact with the email system. It includes a means to compose messages and replies to
messages, display incoming messages, and organize messages by filing, searching, and discarding
them. The act of sending new messages into the mail system for delivery is called mail submission
2 types of user agents: command-driven and GUI-based.
• Command-Driven : accepts a one-character command from the keyboard to perform its task. For
example, a user can type the character r, at the command prompt, to reply to the sender of the
message, or type the character R to reply to the sender and all recipients.
• GUI-Based : contain graphical-user interface (GUI) components that allow the user to interact
with the software by using both the keyboard and the mouse. They have graphical components
such as icons, menu bars, and windows that make the services easy to access. Some examples of
GUI-based user agents are Eudora, Microsoft's Outlook, and Netscape.
Message transfer agents : are system processes which run in the background on mail server
machines – they automatically move email through the system from the originator to the recipient
with SMTP (Simple Mail Transfer Protocol). This is the message transfer step.
SMTP - sends mail over connections and reports back the delivery status and any errors.
Message transfer agents also implement mailing lists, in which an identical copy of a message is
delivered to everyone on a list of email addresses.
Mailboxes : store the email that is received for a user. They are maintained by mail servers. User
agents present users with a view of the contents of their mailboxes. To do this, the user agents send
the mail servers commands to manipulate the mailboxes, inspecting their contents, deleting
messages, and so on. The retrieval of mail is the final delivery
Push Pop
Push Pop
Sending Mail :
To send mail, the user, through the UA, creates
mail that has an envelope and a message
Receiving Mail :
The user agent is triggered by the user or a timer.
If a user has mail, the UA informs the user with a
notice. If the user is ready to read the mail. A list
with message subject and summary is displayed
to the user. The summary usually includes the
sender mail address, the subject, and the time the
mail was sent or received. The user can select
any of the messages and display its contents on
the screen
The formal protocol that defines the MTA client and server in the Internet is called the Simple Mail
Transfer Protocol (SMTP) - is used two times, between the sender and the sender's mail server and
between the two mail servers. It defines how commands and responses must be sent back and forth
SIES Graduate School of Technology Computer Network and Network Design
Dept. of AIML 33
Ms. Gigi Joseph
The material in this presentation belongs to SIES Graduate School of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
Mail access starts with the client when the user needs to download e-mail from the mailbox on the
mail server. The client opens a connection to the server on TCP port 110. It then sends its user name
and password to access the mailbox. The user can then list and retrieve the mail messages, one by one
A user can partially download e-mail. This is especially useful if bandwidth is limited and
the e-mail contains multimedia with high bandwidth requirements.
A user can create, delete, or rename mailboxes on the mail server.
A user can create a hierarchy of mailboxes in a folder for e-mail storage
The data connection is made between the data transfer processes- is opened and then closed
for each file transferred - opens each time commands that involve transferring files are used,
and it closes when the file is transferred.
when a user starts an FTP session, the control connection opens. While the control connection
is open, the data connection can be opened and closed multiple times if several files are
transferred
Fig. FTP moves files between local and remote file systems
SIES Graduate School of Technology Computer Network and Network Design
Dept. of AIML 40
Ms. Gigi Joseph
The material in this presentation belongs to SIES Graduate School of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
Before sending the file through the data connection, it is prepared for transmission through the
control connection.
The client must define the type of file to be transferred, the structure of the data, and the
transmission mode.
File type :
FTP can transfer one of the following file types across the data connection:
• ASCII file : default format for transferring text files - each character is encoded using 7-bit
ASCII. The sender transforms the file from its own representation into ASCII characters,
and the receiver transforms the ASCII characters to its own representation.
• EBCDIC file : If one or both ends of the connection use EBCDIC encoding (the file format
used by IBM), the file can be transferred using EBCDIC encoding.
• Image file : default format for transferring binary files - file is sent as continuous streams of
bits without any interpretation or encoding
Data Structure :
FTP can transfer a file across the data connection by using one of the structure of the data:
• file structure : the file is a continuous stream of bytes
• record structure : the file is divided into records
• page structure : file is divided into pages, with each page having a page number and a page
header - pages can be stored and accessed randomly or sequentially.
SIES Graduate School of Technology Computer Network and Network Design
Dept. of AIML 44
Ms. Gigi Joseph
The material in this presentation belongs to SIES Graduate School of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
Transmission Mode :
FTP can transfer a file across the data connection by using one of the following three transmission
modes:
• Stream mode : the default mode - data are delivered from FTP to TCP as a continuous stream of
bytes. TCP is responsible for chopping data into segments of appropriate size.
• Block mode : data can be delivered from FTP to TCP in blocks - each block is preceded by a 3-
byte header. The first byte is called the block descriptor; the next 2 bytes define the size of the
block in bytes.
• Compressed mode : uses run-length encoding - consecutive appearances of a data unit are
replaced by one occurrence and the number of repetitions
• Unlike SMTP, HTTP messages are not destined to be read by humans - are read and interpreted
by the HTTP server and HTTP client (browser).
• SMTP messages are stored and forwarded, but HTTP messages are delivered immediately.
• Commands from the client to the server are embedded in a request message - contents of the
requested file or other information are embedded in a response message.
• HTTP uses the services of TCP on well-known port 80.
SIES Graduate School of Technology Computer Network and Network Design
Dept. of AIML 46
Ms. Gigi Joseph
The material in this presentation belongs to SIES Graduate School of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
HTTP Transaction :
• Web browsers (such as Internet Explorer and Firefox) implement the client side of HTTP
Web servers implement the server side of HTTP – they house Web objects, each addressable by
a URL- eg. Apache and Microsoft Internet Information Server
• HTTP defines how Web clients request Web pages from Web servers and how servers transfer
Web pages to clients.
i. When a user requests a Web page (eg.clicks on a hyperlink), the browser sends HTTP
request messages for the objects in the page to the server.
ii. Server receives the requests and responds with HTTP response messages that contain the
objects. HTTP uses TCP as its underlying transport protocol -HTTP client first initiates a
TCP connection with the server.
iii. Once the connection is established, the browser and the server processes access TCP
through their socket interfaces - Once the client sends a message into its socket interface,
the message is out of the client’s hands and is “in the hands” of TCP.
iv. Each HTTP request message sent by a client process eventually arrives intact at the server;
similarly, each HTTP response message sent by the server process eventually arrives intact
at the client.
v. server sends requested files to clients without storing any state information about the client
- HTTP server maintains no information about the clients, HTTP is said to be a stateless
protocol.
HTTP Messages :
• Request and Status Lines : first line in a request message - request line; first line in the response
message - status line
Request Type : request type is categorized into methods as given in the table on the next slide
URL :is a standard for specifying any kind of information/documents distributed throughout the
world on the Internet
Version : most current version of HTTP is 1.1.
Status code : used in the response message - consists of three digits.
Status phrase : used in the response message - explains the status code in text form.
SIES Graduate School of Technology Computer Network and Network Design
Dept. of AIML 50
Ms. Gigi Joseph
The material in this presentation belongs to SIES Graduate School of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
• Body: can be present in a request or response message - contains the document to be sent or
received.
• 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.
header can consist of one or more header lines - Each header line has a header name, a colon, a
space, and a header value
header line belongs to one of four categories: general header, request header, response header,
and entity header - A request message can contain only general, request, and entity headers - A
response message, on the other hand, can contain only general, response, and entity headers
o General header - gives general information about the message and can be present in both a
request and a response.
o Request header - can be present only in a request message - specifies the client's
configuration and the client's preferred document format.
o Response header - can be present only in a response message - specifies the server's
configuration and special information about the request
o Entity header - gives information about the body of the document
Non-persistent Connection –
• one TCP connection is made for each request/response.
• in this strategy, for N different pictures in different files, the connection must be opened and
closed N times.
• non-persistent strategy imposes high overhead on the server because the server needs N different
buffers and requires a slow start procedure each time a connection is opened.
• Shortcomings:
a) a brand-new connection must be established and maintained for each requested object - for
each of these connections, TCP buffers must be allocated and TCP variables must be kept in
both the client and server - this can place a significant burden on the Web server
b) each object suffers a delivery delay of two RTTs - one RTT to establish the TCP connection
and one RTT to request and receive an object
Persistent Connection –
• HTTP version 1.1 specifies a persistent connection by default.
• In a persistent connection, the server leaves the connection open for more requests after sending a
response.
• The server can close the connection at the request of a client or if a time-out has been reached.
• The sender usually sends the length of the data with each response.
when a document is created dynamically or actively, sender doesn’t know the length of the data,
the server informs the client that the length is not known and closes the connection after sending
the data so the client knows that the end of the data has been reached.
• default mode of HTTP uses persistent connections with pipelining.
• Issue with automatic assignment of IP addresses from a pool – for how long an IP address should
be allocated - If a host leaves the network and does not return its IP address to the DHCP server,
that address will be permanently lost - After a period of time, many addresses may be lost - To
prevent that from happening, DHCP provides temporary IP addresses for a limited time - The
addresses assigned from the pool are temporary addresses - The DHCP server issues a lease for a
specific time - When the lease expires, the client must either stop using the IP address or renew the
lease - The server has the option to agree or disagree with the renewal - If the server disagrees, the
client stops using the address
SIES Graduate School of Technology Computer Network and Network Design
Dept. of AIML 61
Ms. Gigi Joseph
The material in this presentation belongs to SIES Graduate School of Technology and is solely for educational purposes. Distribution and modifications of the content is prohibited.
• Step 1 :The host sends a DHCPDISCOVER broadcast message to locate a DHCP server.
• Step 2 :A DHCP server offers configuration parameters such as an IP address, a MAC
address, a domain name, a default gateway, and a lease for the IP address to the
client in a DHCPOFFER unicast message.
• Step 3 :The client returns a formal request for the offered IP address to the DHCP server in
a DHCPREQUEST broadcast message.
• Step 4 :The DHCP server confirms that the IP address has been allocated to the client by
returning a DHCPACK unicast message to the client.