DNT 1013DATA COMMUNICATIONS
------------------------------------------CHAPTER 6:
APPLICATION LAYER
Prepared By:Mdm Noor Suhana Bt SulaimanFKMT-NT, TATiUC
DOMAIN NAME SYSTEM
DNS: Domain Name SystemImagine a world without DNSYou would have to remember the IP addresses of
Every website you want to visitYour bookmarks will be a list of IP addressesYou will speak like
“I went to 167.33.24.10, and there was an awesome link to 153.11.35.81… “
DNS- HostnamesIP Addresses are great for computers
IP address includes information used for routing.
IP addresses are tough for humans to remember.
IP addresses are impossible to guess.ever guessed at the name of a WWW site?
The Domain Name SystemThe domain name system is usually used to
translate a host name into an IP address .
Domain names comprise a hierarchy so that names are unique, yet easy to remember.
DNS Hierarchy
edu com org jp
rpi albany
Host name structureEach host name is made up of a sequence of labels
separated by periods.Each label can be up to 63 charactersThe total name can be at most 255 characters.
Examples:whitehouse.govbarney.the.purple.dinosaur.commonica.cs.rpi.edu
Domain NameThe domain name for a host is the sequence
of labels that lead from the host (leaf node in the naming tree) to the top of the worldwide naming tree.
A domain is a subtree of the worldwide naming tree.
Top level domainsedu, gov, com, net, org, mil, …Countries each have a top level domain (2
letter domain name).New top level domains include:
.aero .biz .coop .info .name .pro
Root DNS Servers
com DNS servers org DNS servers edu DNS servers
poly.eduDNS servers
umass.eduDNS servers
yahoo.comDNS servers
amazon.comDNS servers
pbs.orgDNS servers
Distributed, Hierarchical Database
Client wants IP for www.amazon.com; 1st approx:Client queries a root server to find .com DNS serverClient queries com DNS server to get amazon.com
DNS serverClient queries amazon.com DNS server to get IP
address for www.amazon.com
Client wants IP for www.amazon.com; 1st approx:Client queries a root server to find .com DNS serverClient queries com DNS server to get amazon.com
DNS serverClient queries amazon.com DNS server to get IP
address for www.amazon.com
DNS: Root name serverscontacted by local name server that can not resolve nameroot name server:
contacts authoritative name server if name mapping not known
gets mappingreturns mapping to local name server
13 root name servers worldwideb USC-ISI Marina del Rey, CA
l ICANN Los Angeles, CA
e NASA Mt View, CAf Internet Software C. Palo Alto, CA (and 17 other locations)
i Autonomica, Stockholm (plus 3 other locations)
k RIPE London (also Amsterdam, Frankfurt)
m WIDE Tokyo
a Verisign, Dulles, VAc Cogent, Herndon, VA (also Los Angeles)d U Maryland College Park, MDg US DoD Vienna, VAh ARL Aberdeen, MDj Verisign, ( 11 locations)
REMOTE LOGGING, ELECTRONIC EMAIL &
FILE TRANSFER
Electronic MailThree major components: user agents mail servers simple mail transfer protocol:
SMTP
User Agenta.k.a. “mail reader”composing, editing, reading
mail messagese.g., Eudora, Outlook, elm,
Netscape Messengeroutgoing, incoming messages
stored on server
user mailbox
outgoing message queue
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
Electronic Mail: mail servers
Mail Servers mailbox contains incoming
messages for usermessage queue of outgoing
(to be sent) mail messagesSMTP protocol between
mail servers to send email messagesclient: sending mail
server“server”: receiving mail
server
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
Electronic Mail: mail servers
Mail Servers mailbox contains incoming
messages for usermessage queue of outgoing
(to be sent) mail messagesSMTP protocol between
mail servers to send email messagesclient: sending mail
server“server”: receiving mail
server
mailserver
useragent
useragent
useragent
mailserver
useragent
useragent
mailserver
useragent
SMTP
SMTP
SMTP
Scenario: Alice Emails Bob1) Alice uses UA to
compose message and “to” [email protected]
2) Alice’s UA sends message to her mail server; message placed in message queue
3) Client side of SMTP opens TCP connection with Bob’s mail server
4) SMTP client sends Alice’s message over the TCP connection
5) Bob’s mail server places the message in Bob’s mailbox
6) Bob invokes his user agent to read message
useragent
mailserver
mailserver user
agent
1
2 3 4 56
SMTP Commands to send emailTelenet into port 25HELO hostnameMAIL FROMRCPT TORCPT TO …DATA… text ….QUIT
You can try doing this yourself
Try SMTP interaction for yourself:
telnet servername 25see 220 reply from serverenter HELO, MAIL FROM, RCPT TO, DATA, QUIT
commands above lets you send email without using email client
(reader)
SMTP: final wordsSMTP uses persistent
connectionsSMTP requires message
(header & body) to be in 7-bit ASCII
SMTP server uses CRLF.CRLF to determine end of message
Comparison with HTTP:
HTTP: pullSMTP: push
both have ASCII command/response interaction, status codes
HTTP: each object encapsulated in its own response msg
SMTP: multiple objects sent in multipart msg
Mail message formatSMTP: protocol for
exchanging email msgsRFC 822: standard for text
message format:header lines, e.g.,
To: From: Subject:different from SMTP
commands!body
the “message”, ASCII characters only
header
body
blankline
Message format: multimedia extensionsMIME: multimedia mail extension, RFC 2045, 2056additional lines in msg header declare MIME
content typeThink of image attachments with your email
From: [email protected] To: [email protected] Subject: Picture of yummy crepe. MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Type: image/jpeg
base64 encoded data ..... ......................... ......base64 encoded data
multimedia datatype, subtype,
parameter declaration
method usedto encode data
MIME version
encoded data
Mail access protocols
SMTP: delivery/storage to receiver’s serverMail access protocol: retrieval from server
POP: Post Office Protocol [RFC 1939] authorization (agent <-->server) and download
IMAP: Internet Mail Access Protocol [RFC 1730] more features (more complex) manipulation of stored msgs on server
HTTP: Hotmail , Yahoo! Mail, etc.
useragent
sender’s mail server
useragent
SMTP SMTP accessprotocol
receiver’s mail server
What’s theDifference?
What’s theDifference?
POP3 (more) and IMAPMore about POP3Previous example uses
“download and delete” mode.
Bob cannot re-read e-mail if he changes client
“Download-and-keep”: copies of messages on different clients
POP3 is stateless across sessions
IMAPKeep all messages in
one place: the serverAllows user to organize
messages in foldersIMAP keeps user state
across sessions:names of folders and
mappings between message IDs and folder name
FTPFile Transfer Protocol (FTP), a standard Internet
protocol, is the simplest way to exchange files between computers on the Internet.
Like the Hypertext Transfer Protocol (HTTP), which transfers displayable Web pages and related files, and the Simple Mail Transfer Protocol (SMTP), which transfers e-mail, FTP is an application protocol that uses the Internet's TCP/IP protocols.
FTP is commonly used to transfer Web page files from their creator to the computer that acts as their server for everyone on the Internet.
It's also commonly used to download programs and other files to computer from other servers.
Cont..User can use FTP with a simple command line
interface (for example, from the Windows MS-DOS Prompt window) or with a commercial program that offers a graphical user interface.
User Web browser can also make FTP requests to download programs you select from a Web page.
Using FTP, user can also update (delete, rename, move, and copy) files at a server.
User need to logon to an FTP server. However, publicly available files are easily accessed using anonymous FTP.
Cont..Basic FTP support is usually provided as part
of a suite of programs that come with TCP/IP. However, any FTP client program with a
graphical user interface usually must be downloaded from the company that makes it.
Web ServerA computer program that is responsible for accepting HTTP
requests from clients (user agents such as web browsers), and serving them HTTP responses along with optional data contents, which usually are web pages such as HTML documents and linked objects (images, etc.).
A computer that delivers (serves up) Web pages. Every Web server has an IP address and possibly a domain name
For example, if you enter the URL http://www.pcwebopedia.com/index.html in your browser, this sends a request to the server whose domain name is pcwebopedia.com.
The server then fetches the page named index.html and sends it to your browser.
Any computer can be turned into a Web server by installing server software and connecting the machine to the Internet.
There are many Web server software applications, including public domain software from NCSA and Apache, and commercial packages from Microsoft, Netscape and others.
Cont..Web server is a program that, using the client/server
model and the World Wide Web's Hypertext Transfer Protocol ( HTTP ), serves the files that form Web pages to Web users (whose computers contain HTTP clients that forward their requests).
Every computer on the Internet that contains a Web site must have a Web server program. Two leading Web servers are Apache , the most widely-installed Web server, and Microsoft's Internet Information Server ( IIS ).
Other Web servers include Novell's Web Server for users of its NetWare operating system and IBM's family of Lotus Domino servers, primarily for IBM's OS/390 and AS/400 customers.
Cont..Web servers often come as part of a larger
package of Internet- and intranet-related programs for serving e-mail, downloading requests for File Transfer Protocol ( FTP ) files, and building and publishing Web pages.
Considerations in choosing a Web server include how well it works with the operating system and other servers, its ability to handle server-side programming, security characteristics, and publishing, search engine, and site building tools that may come with it.
Cont..The origin of the content sent by server is
called:static if it comes from an existing file lying on
a filesystem; dynamic if it is dynamically generated by
some other program or script or application programming interface (API) called by the web server.
Serving static content is usually much faster (from 2 to 100 times) than serving dynamic content, especially if the latter involves data pulled from a database.
Web Server featuresAlthough web server programs differ in detail, they all
share some basic common features.HTTP: every web server program operates by accepting
HTTP requests from the client, and providing an HTTP response to the client. The HTTP response usually consists of an HTML document, but can also be a raw file, an image, or some other type of document (defined by MIME-types). If some error is found in client request or while trying to serve it, a web server has to send an error response which may include some custom HTML or text messages to better explain the problem to end users.
Logging: usually web servers have also the capability of logging some detailed information, about client requests and server responses, to log files; this allows the webmaster to collect statistics by running log analyzers on these files.
HTTP overviewHTTP: hypertext transfer
protocolWeb’s application layer
protocolclient/server model
client: browser that requests, receives, “displays” Web objects
server: Web server sends objects in response to requests
HTTP 1.0: RFC 1945HTTP 1.1: RFC 2068
PC runningExplorer
Server running
Apache Webserver
Mac runningNavigator
HTTP request
HTTP request
HTTP response
HTTP response
HTTP overview (continued)Uses TCP:client initiates TCP
connection (creates socket) to server, port 80
server accepts TCP connection from client
HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)
TCP connection closed
HTTP is “stateless”server maintains no
information about past client requests
Protocols that maintain “state” are complex!
past history (state) must be maintained
if server/client crashes, their views of “state” may be inconsistent, must be reconciled
aside
HTTP connectionsNonpersistent HTTPAt most one object is
sent over a TCP connection.
HTTP/1.0 uses nonpersistent HTTP
Persistent HTTPMultiple objects can be
sent over single TCP connection between client and server.
HTTP/1.1 uses persistent connections in default mode
HTTP Protocol HTTP (Hypertext Transfer Protocol) is the set of rules for
transferring files (text, graphic images, sound, video, and other multimedia files) on the World Wide Web.
As soon as a Web user opens their Web browser, the user is indirectly making use of HTTP.
HTTP is an application protocol that runs on top of the TCP/IP suite of protocols (the foundation protocols for the Internet).
In order to fetch a web page for you, your web browser must "talk" to a web server somewhere else.
When web browsers talk to web servers, they speak a language known as HTTP, which stands for HyperText Transfer Protocol.
The latest version of HTTP is HTTP 1.1.
Cont..HTTP concepts include (as the Hypertext part of the name
implies) the idea that files can contain references to other files whose selection will elicit additional transfer requests.
Any Web server machine contains, in addition to the Web page files it can serve, an HTTP daemon, a program that is designed to wait for HTTP requests and handle them when they arrive.
Your Web browser is an HTTP client, sending requests to server machines.
When the browser user enters file requests by either "opening" a Web file (typing in a Uniform Resource Locator or URL) or clicking on a hypertext link, the browser builds an HTTP request and sends it to the Internet Protocol address (IP address) indicated by the URL.
The HTTP daemon in the destination server machine receives the request and sends back the requested file or files associated with the request. (A Web page often consists of more than one file.)
Cont..Hypertext Transfer Protocol (HTTP) is an application-
level protocol for distributed, collaborative, hypermedia information systems.
Its use for retrieving inter-linked resources led to the establishment of the World Wide Web.
HTTP development was coordinated by the World Wide Web Consortium and the Internet Engineering Task Force (IETF), culminating in the publication of a series of Requests for Comments (RFCs), most notably RFC 2616 (June 1999), which defines HTTP/1.1, the version of HTTP in common use.
Cont..HTTP is a request/response standard between a client and
a server. A client is the end-user, the server is the web site. The
client making a HTTP request—using a web browser, spider, or other end-user tool—is referred to as the user agent.
The responding server—which stores or creates resources such as HTML files and images—is called the origin server.
In between the user agent and origin server may be several intermediaries, such as proxies, gateways, and tunnels.
HTTP is not constrained to using TCP/IP and its supporting layers, although this is its most popular application on the Internet. Indeed HTTP can be "implemented on top of any other protocol on the Internet, or on other networks.
HTTP only presumes a reliable transport; any protocol that provides such guarantees can be used
Cont..HTTP predominantly uses TCP and not UDP because
much data must be sent for a webpage, and TCP provides transmission control, presents the data in order, and provides error correction.
Resources to be accessed by HTTP are identified using Uniform Resource Identifiers (URIs) (or, more specifically, Uniform Resource Locators (URLs)) using the http: or https URL schemes.
HTTP Transaction HTTP uses only one TCP connection on Well-Known port 80 Ex) protocol://hostname[:port]/path/filename
Cont..Step 1: Connection Establishment
TCP/IP connection set up uses a port number as application reference usually port 80 ports ≤ 1024 are privileged (>1024 are open)
Step 2: Client’s request HTTP message sent with a request line
Step 3: Server Response server sends HTTP message and optionally requested
dataStep 4: Server Disconnection
usually the server sometimes the client “stops” it
Cont..http is “stateless”
server maintains no information about past client requests
each operation or transaction makes a new connection
each operation is unaware of any other connection
each click is a new connection
MessageMessage categories
Request message : Client ServerResponse message : Server Client
Request message format
Request Line Request line
Request type : methods (GET,HEAD,POST…) Uniform Resource Locator (URL) : Protocol (FTP,HTTP,TELNET…) HTTP version : HTTP 1.1(1.0, 0.9 are still in use)
Cont..Resources
A resource is a chunk of information that can be identified by a URL(Universal Resource Locator)
A resource can be A file A dynamically created page
What we see on the browser can be a combination of some resources
Cont.. URL(Uniform Resource Locator)
Method is the protocol used to retrieve the document among them are FTP, HTTP, News and TELNET
MethodsMethods
Methods is actual command or request that a client issues to the server
Methods kinds GET
Client wants to retrieve a document from the server Responds with the contents of the document in the
body of the response message HEAD
Client wants some information about a document Response from the server does net contain a body
(different from GET) POST
Client provides some information for the server ex) send input to a server
Cont.. Methods kinds
PUT Client provides a new or replacement document to be stored on the
server Included in the body of the request and will be stored in the
location defined by the URL PATCH
Only a list of differences that should be implemented in the existing file
COPY Used to copy a file to another location Location of the source file is given in the request line (URL),
destination is given in the entity header MOVE
Used to move a file to another location Location of the source file is given in the request line (URL),
destination is given in the entity header
Cont..Methods kinds
DELETE Used to remove a document on the server
LINK Used to create a link or links from a document to another
location Location of the source file is given in the request line
(URL), destination is given in the entity header UNLINK
Used to delete links created by the LINK methods OPTION
Used by the client to ask the server about available options
CHECKIN, CHECKOUT, SHOWMETHOD, SPACEJUMP etc.
Response Message
Status Line Status Line
Defines the status of the response message consists : HTTP version + a space + a status code +
a space + a status phrase HTTP version : HTTP 1.1 (1.0, 0.9 are also in use)
Status Code
There is no content in the bodyNo content204
The request is accepted, but it is not immediately acted upon
Accepted202
A new URL is createdCreated201
The request is successfulOK200
Success
The server is complying with a client request to switch protocols defined in the upgrade header
Switching101
The initial part of the request has been received and the client may continue with is request
Continue100
Informational
DescriptionPhraseCode
Cont..
The format requested is not acceptableNot acceptable406
The method is not supported in this URLMethod not allowed405
Server Error
There is an error, such as a crash, in the server siteInternal server error
500
The requested URL is no longer used by the serverMoved permanently302
The request lacks proper authorizationUnauthorized401
Service is deniedForbidden403
The service is temporarily unavailable, but may be requested in the future
Service unavailable503
The action requested act not be performedNot implement501
The document is not foundNot found404
There is a syntax error in the requestBad request400
Client Error
The requested URL has moved temporarilyMoved temporarily304
The requested URL refers to more than one resource
Multiple choices301
Redirection
DescriptionPhraseCode
And one truly last word…
ThAnKs