0% found this document useful (0 votes)
9 views34 pages

Unit 5

Uploaded by

ameer.amartey
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)
9 views34 pages

Unit 5

Uploaded by

ameer.amartey
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/ 34

Computer Network – Unit - V

Application Layer
• Having finished all the preliminaries, we now come to the layer where all the applications are
found.
• The layers below the application layer are there to provide transport services, but they do not
do real work for users.
• However, even in the application layer there is a need for support protocols, to allow the
applications to function
Application Layer
DNS – The Domain Name System
• Although programs theoretically could refer to Web pages, mailboxes, and other resources by
using the network (e.g., IP) addresses of the computers on which they are stored, these
addresses are hard for people to remember.
• Also, browsing a company’s Web pages from 128.111.24.41 means that if the company moves
the Web server to a different machine with a different IP address, everyone needs to be told
the new IP address.
• Consequently, high-level, readable names were introduced in order to decouple machine
names from machine addresses.
• since the network itself understands only numerical addresses, some mechanism is required to
convert the names to network addresses.
Application Layer
DNS – The Domain Name System
• Well before many millions of PCs were connected to the Internet, everyone involved with it
realized that this approach could not continue to work forever.
• For one thing, the size of the file would become too large.
• However, even more importantly, host name conflicts would occur constantly unless names
were centrally managed, something unthinkable in a huge international network due to the
load and latency.
• To solve these problems, DNS (Domain Name System) was invented in 1983.
• It has been a key part of the Internet ever since.
Application Layer
DNS – The Domain Name System
• The essence of DNS is the invention of a hierarchical, domain-based naming scheme and a
distributed database system for implementing this naming scheme.
• It is primarily used for mapping host names to IP addresses but can also be used for other
purposes.
Application Layer
DNS – The DNS Name Space
• The top of the naming hierarchy is managed by an organization called ICANN (Internet
Corporation for Assigned Names and Numbers).
• ICANN was created for this purpose in 1998, as part of the maturing of the Internet to a
worldwide, economic concern.
• Conceptually, the Internet is divided into over 250 top-level domains, where each domain
covers many hosts.
• Each domain is partitioned into subdomains, and these are further partitioned, and so on.
• All these domains can be represented by a tree, as shown in Fig.
Application Layer
DNS – The DNS Name Space
Application Layer
DNS – The DNS Name Space
• The leaves of the tree represent domains that have no subdomains (but do contain machines,
of course).
• A leaf domain may contain a single host, or it may represent a company and contain thousands
of hosts.
Application Layer
DNS – The DNS Name Space
• The top-level domains come in two flavors: generic and
countries.
• The generic domains, listed in Fig., include original domains from
the 1980s and domains introduced via applications to ICANN.
• Other generic top-level domains will be added in the future.
• The country domains include one entry for every country, as
defined in ISO 3166.
• Internationalized country domain names that use non Latin
alphabets were introduced in 2010. These domains let people
name hosts in Arabic, Cyrillic, Chinese, or other languages
Application Layer
DNS – The DNS Name Space
• Getting a second-level domain, such as
name-of-company.com, is easy.
• The top-level domains are run by registrars appointed
by ICANN.
• Getting a name merely requires going to a corresponding registrar (for com in this case) to
check if the desired name is available and not somebody else’s trademark.
• If there are no problems, the requester pays the registrar a small annual fee and gets the
name.
Application Layer
SMTP – Simple Mail Transfer Protocol
• The architecture of the email system is shown in Fig.
• It consists of two kinds of subsystems: the user agents, which allow people to read and send
email, and the message transfer agents, which move the messages from the source to the
destination.
• We will also refer to message transfer agents informally as mail servers.
Application Layer
SMTP – Simple Mail Transfer Protocol
• The user agent is a program that provides a graphical interface, or sometimes 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.
Application Layer
SMTP – Simple Mail Transfer Protocol
• The message transfer agents are typically system processes.
• They run in the background on mail server machines and are intended to be always available.
• Their job is to automatically move email through the system from the originator to the
recipient with SMTP (Simple Mail Transfer Protocol).
• This is the message transfer step.
Application Layer
SMTP – Simple Mail Transfer Protocol
• Basically, in SMTP the actual transfer of the mail is done through the message transfer agent
(MTA).
• Hence, to send the mail, the system must have the client MTA and similarly, to receive the
mail, the system must have the server MTA.
• Using the SMTP protocol, a TCP connection to the SMTP server is opened and then the client
sends the email across the TCP connection.
• As soon as the server listens for the TCP connection from any client the connection is
established on port 25 and the connection becomes successful hence the clients can send or
receive the email immediately.
Application Layer
SMTP – Simple Mail Transfer Protocol
Components of SMTP
There are four components in the SMTP:
• Mail User Agent (MUA)
• Mail Submission Agent (MSA)
• Mail Transfer Agent (MTA)
• Mail Delivery Agent (MDA)
Application Layer
SMTP – Simple Mail Transfer Protocol
Working of Simple Mail Transfer Protocol (SMTP)
• A sender drafts the mail and hits the send button.
• Once an SMTP server is established, email clients can connect and communicate with the
server.
• As the sender has pressed the send button, this triggers the email client to open an SMTP
connection to the server to make a connection so that it can send the emails.
• Now, the SMTP client uses various commands available in the SMTP to communicate with the
server and to transfer the data like the mail address of the sender.
Application Layer
SMTP – Simple Mail Transfer Protocol
Working of Simple Mail Transfer Protocol (SMTP)
• Then the Mail Transfer Agent(MTA) ensures that both the mail addresses are from the same
email domain.
• If they are the same, it sends the email.
• But if not, the server uses the DNS(Domain Name System) to identify the recipient's domain,
and then it'll send it to the right server.
Application Layer
SMTP – Simple Mail Transfer Protocol
Comman
Description
d
This command is used for beginning the email-sending process and is used to identify the
HELO user and full domain name. It is the beginning of the conversation in which the server
sends a HELO command back with its domain name.
This command is used to initiate the message transfer and identifies the originator of the
MAIL mail. From this command, the server resets everything and is ready to accept the email
address and after accepting, it'll reply with the 250 OK code.
This command identifies the recipient of the mail and again the SMTP server responds
RCPT
with the same code.
DATA This command triggers the transfer of data between the client and the server.
After the email has been sent, the client sends this command to quit the server and if it is
QUIT
closed successfully, the server will reply with a 221 code.
To abort or cancel the mail transaction, this command is used. This doesn't close the
RSET connection but it does reset everything and removes all the previous data about the mail
and the email addresses.
Application Layer
HTTP – Hyper Text Transfer Protocol
• Have you thought about what happens when we enter a URL (Uniform Resource Locator) in the
browser to visit a website?
• The browser fetches the IP address corresponding to the entered URL using DNS (Domain
Name System). Once the browser gets the IP address corresponding to the entered URL, the
browser sends a request to the server at the backend (along with the IP address of the website)
to fetch the webpage of the website.
• In return, the browser receives a response from the server and this response contains the
HTML (Hypertext Markup Language) information of the webpage.
• These requests and responses that are sent follow a protocol which is called HTTP (Hypertext
Transfer Protocol).
Application Layer
HTTP – Hyper Text Transfer Protocol
How Does Hypertext Transfer Protocol Work?
Below is a step-by-step discussion of how the Hypertext transfer protocol works.
1. Extracting the IP address of a URL (Uniform Resource Locator)
• In our browser, we enter the URL address of the website we want to visit.
• Once we enter the URL address of the website, the browser with the help of the DNS extracts
the IP address corresponding to the URL address that is entered.
• The DNS contains the mapping of the URLs along with their corresponding IP addresses.
Application Layer
HTTP – Hyper Text Transfer Protocol
How Does Hypertext Transfer Protocol Work?
2. Sending request to the server to access the webpage and receiving response

• Once we get the IP address of the website, the browser sends an HTTP request to the server to
extract the HTML webpage corresponding to the IP address.
• This request is sent over PORT 80 using TCP.
• Once the server receives this HTTP request, it responds back with an HTTP response.
• This HTTP response consists of the information related to the HTML page corresponding to the
IP address of the website.
Application Layer
HTTP – Hyper Text Transfer Protocol
How Does Hypertext Transfer Protocol Work?
3. Receiving HTTP response and displaying the webpage
• The browser receives the HTML information for the website along with the response and
hence, it processes and displays the HTML page on the browser.
• Finally, the users can see an HTML page for the URL that they entered.
Application Layer
HTTP – Hyper Text Transfer Protocol
What is in an HTTP Request?
• In order to fetch the webpage corresponding to a given IP address, the browser sends a
request (called as HTTP request) to the web server.
• An HTTP request consists of 3 parts i.e. a request line, request headers, and request body.
Application Layer
HTTP – Hyper Text Transfer Protocol
What is in an HTTP Request?
Request Line
An HTTP request-line consists of 3 parts which are discussed below.
1.Request Method A request method defines what type of request is needed to send to the web
server. For example, if we want to fetch something from the web server, we use a GET request
method. If we want to send something from the client to the web server, we use POST request
method.
2.Request URI It is the the URI of the website/destination we want to reach. For example
"http://google.com/".
3.HTTP Version It states the version of the HTTP we are using. For example HTTP 1.0, HTTP 1.1.
Application Layer
HTTP – Hyper Text Transfer Protocol
What is in an HTTP Request?
Request Headers
• Request headers contain additional information about the resource/data that is to be fetched
from the web server.
• For example, if we want the data in the plaintext format, we can specify that information in
the HTTP headers.
• We can also specify the information related to the client using headers like the browser it is
using etc.
• We can send more than one HTTP header along with an HTTP request to specify the additional
information that is to be sent along with an HTTP request.
Application Layer
HTTP – Hyper Text Transfer Protocol
What is in an HTTP Request?
Request Body
• It is an optional part of an HTTP request.
• If there is a requirement to send some data along with an HTTP request, we send that data
along with the HTTP Body.
• For example: If we want to send the details of a user which is taken through a form at the
client side to the web server, we can send this data in the HTTP body.
Application Layer
HTTP – Hyper Text Transfer Protocol
What is in an HTTP Response?
Application Layer
HTTP – Hyper Text Transfer Protocol
What is in an HTTP Response?
Response Headers

• The response headers are used to specify the additional information related to the response
data and the server.
Response Body
• It is an optional part of the HTTP response. The data which is requested by the client using the
HTTP request is sent from server to client by keeping it inside the response body.
Application Layer
HTTP – Hyper Text Transfer Protocol
Status Code
An HTTP status code is a three-digit code that specifies the status of the HTTP response. Some of
the commonly seen HTTP status codes along with their description are given below.

Status Code Phrase Description


200 OK A successful request.
404 Page not found The requested document is not present.
500 Internal server error An error such as a server crash has occurred.
400 Bad request There is some syntax error in the code.
Application Layer
HTTP – Hyper Text Transfer Protocol
Features of HTTP
1. HTTP is a stateless protocol
• HTTP does not store the state/information of the client as well as the server and hence, is a
stateless protocol. But with the help of cookies, we can make HTTP protocol as a stateful protocol.
2. Connection Oriented Protocol
• Since HTTP relies on the TCP (Transmission Control Protocol), it is a connection-oriented protocol.
Hence, the connection is established and the data is sent over the connection only after the
establishment of the connection.
3. Compatible with multiple file-formats
• HTTP can be used to transfer data in various file formats such as HTML, plaintext file, audio file,
video file etc.
Application Layer
HTTP – Hyper Text Transfer Protocol
HTTP vs HTTPS
Hypertext Transfer Protocol (HTTP) Hypertext Transfer Protocol Secure (HTTPS)
1. HTTP is a protocol used to transfer data over 1. HTTPS is also used to transfer data over the
the internet. internet but it is more secure than HTTP.
2. It uses cryptographic algorithms like SSL
2. It does not use cryptographic algorithms to
(Secure Socket Layer) and TLS (Transport Layer
encrypt the transmitted data.
Security) which makes it more secure than HTTP
3. The connection of HTTP takes place on PORT 3. The connection of HTTPS takes place on
80. PORT 443.
4. HTTP is faster than HTTPS since it does not
4. HTTPS is slower than HTTP since it includes
include any additional steps for the cryptographic
additional steps for the cryptographic algorithms.
algorithms.
Application Layer
FTP – File Transfer Protocol
HTTP vs HTTPS
• File Transfer Protocol (FTP) is a communication layer protocol that transfers files from one computer to
another computer, with one functioning as a server if both computers have an internet connection.
• FTP, a networking protocol that connects client and server, allows users to download web pages, data, and
programs from other services. FTP is used when a user wants to download information to their own
computer.
• The end user's machine is commonly referred to as the local host in an FTP transaction. The second
computer involved in FTP is a remote host, which is usually a server. Both computers must be
network-connected and correctly set up to transmit files over FTP. To access these services, servers must
be configured to run FTP services, and clients must have FTP software installed.
Application Layer
FTP – File Transfer Protocol
HTTP vs HTTPS
• Despite the fact that many file transfers can be performed using Hypertext Transfer Protocol (HTTP),
i.e., another protocol in the TCP/IP stack. Simultaneously, FTP is still being frequently utilized behind
the scenes for a variety of applications, including banking services. It is also used in web browsers to
download new software.
• Individuals and businesses can share electronic files with others via the file transfer protocol without
needing to be in the same space. This can be accomplished via an FTP client or the cloud.
Application Layer
FTP – File Transfer Protocol
HTTP vs HTTPS
• FTP clients come with most online browsers, allowing users to transfer files from their computer to a
server and vice versa. Some users may prefer to utilize a third-party FTP client because many of
them often come with additional features. Some FTP clients that are available for free to download
are FileZilla Client, FTP Voyager, WinSCP, CoffeeCup Free FTP, and Core FTP.
• Many people have utilized FTP without even knowing it. You've used FTP if you've ever downloaded a file
from a website. The starting step is to log in, which can be done automatically or by manually entering a
username and password. FTP requires a specific port number to access an FTP server. You can transfer files
using your FTP client after connecting to the FTP server. Some public FTP servers do not require you to sign
in because you can access them anonymously.

You might also like