Application Layer Essentials
Application Layer Essentials
Application layer
Reading Chapter 7
Computer networks, Tanenbaum
1
Contents
Application layer
Fundamental concepts
Case study: HTTP, Mail, FTP…
2
Fundamental concepts
3
Application layer in OSI model
Application Protocols communication
between parties of the
(HTTP, Mail, …) application
Transport Transmission data between application
(UDP, TCP …)
Network
(IP, ICMP…)
Datalink
(Ethernet, ADSL…)
Physical
(bits…)
4
Application and service?
MUSIC ONLINE
VoIP
GAME CHAT VoD
ON LINE e-Office
SMS e-BANK
MAIL
E-learning
WEB
YOUTUBE
VIDEO
CONFERENCE FTP
EBAY
GOOGLE SKYPE
Social
networks SSH
7
Communication between application
processes
Socket: an interface between application process and
transport layer
Processes use services provided by transport layer to exchange
information
Socket is identified by port number and IP address
application application
socket controlled by
process process app developer
transport transport
network network controlled
link by OS
link Network
physical physical
10
Client-server
Two kind of components:
client client and server
Client
Client sends requests for service
client to server
Clients do not contact directly to
each other
Server
client
Server Always online waiting for service
requests from clients
There may be backup servers
for assuring high availability in
failures
client
e.g. Web, Mail, …
11
Pure Peer-to-peer architecture
Peer Peer
No center server, only
peers as components
Peers have equal role in
the system
Peer
Peer Any two peers can
communicate directly to
each other but only
when both are online.
Peer does not need to
be online all the time
Peer Peer
E.g. Gnutella, Bittorent
12
Hybrid architecture
A center server for user
Client
management, indexing
for search purpose.
Clients communicate
directly to each other
Server after authentication
process with server.
E.g. Skype (before 2016)
Skype server manage user
lists, authentification
Client Client After authentification users
communicate directly to
each other
P2P Comm. 13
Client-Server Comm.
Domain name service
14
Introduction
Domain name: identifier on application layer for network node
Internet management should be centralised
International: ICANN
Vietnam: VNNIC
DNS(Domain Name System): the Internet's system for
mapping alphabetic names to numeric Internet Protocol (IP)
addresses
Address resolution
Users/ Clients use domain name to access services
Computers and network devices cannot use domain name but IP
address
How to translate domain name to IP address and reverse?
15
Example of address resolution
• Computers use IP
I want to access
• Users use DN www.soict.hust.edu.vn
User
Domain Name
Server
Web server
202.191.56.65
16
DNS Server system
Root server
Answer local DNS servers
Manage zone and decentralize the management to lower-level
servers
There are 13 root servers (http://www.root-servers.org)
17
18
Address resolution
Self-resolution
File HOST:
Windows: C:\WINDOWS\system32\drivers\etc\
Linux: /etc/hosts
Application cache
DNS service: client/server
Application protocol: DNS
Use UDP/TCP with the port 53
Recursive Query
Interactive Query
19
DNS Message
DNS Query and DNS Reply:
Identification Flags
same format
#Question #Answer RRs
Identification
Response must have the same #Authority #Additional
identification of the request RRs RRs
20
DNS Message
#Answer RRs: Number of Identification Flags
answered records
#Question #Answer RRs
ANSWER: Answered records
#Authority #Additional
# Authority RRs: Number of RRs RRs
records that servers are
QUESTION
authorized
ANSWER
AUTHORITY: Records of
authorized servers AUTHORITY
#Additional RRs: Number of ADDITIONAL
additional records
ADDITIONAL: additional
records
21
Example: dig linux.com
; <> DiG 9.9.2-P1 <> linux.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21655
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2,
ADDITIONAL: 3
;; QUESTION SECTION: TTL: timing in cache
;linux.com. IN A
;; ANSWER SECTION:
linux.com. 1786 IN A 140.211.167.51
linux.com. 1786 IN A 140.211.167.50
;; AUTHORITY SECTION:
linux.com. 86386 IN NS ns1.linux-foundation.org.
linux.com. 86386 IN NS ns2.linux-foundation.org.
;; ADDITIONAL SECTION:
ns1.linux-foundation.org. 261 IN A 140.211.169.10
ns2.linux-foundation.org. 262 IN A 140.211.169.11
22
Example: dig linux.com
; <> DiG 9.9.2-P1 <> linux.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21655
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2,
ADDITIONAL: 3
;; QUESTION SECTION: Names of DNS servers answered the request
;linux.com. IN A If ANSWER is empty, DNS Resolver sends
;; ANSWER SECTION: the request to these DNS servers
linux.com. 1786 IN A 140.211.167.51
linux.com. 1786 IN A 140.211.167.50
;; AUTHORITY SECTION:
linux.com. 86386 IN NS ns1.linux-foundation.org.
linux.com. 86386 IN NS ns2.linux-foundation.org.
;; ADDITIONAL SECTION:
ns1.linux-foundation.org. 261 IN A 140.211.169.10
ns2.linux-foundation.org. 262 IN A 140.211.169.11
23
Example : dig linux.com
; <> DiG 9.9.2-P1 <> linux.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21655
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2,
ADDITIONAL: 3
;; QUESTION SECTION: IP address of DNS servers.
;linux.com. IN A Information will be stored in cache
;; ANSWER SECTION:
linux.com. 1786 IN A 140.211.167.51
linux.com. 1786 IN A 140.211.167.50
;; AUTHORITY SECTION:
linux.com. 86386 IN NS ns1.linux-foundation.org.
linux.com. 86386 IN NS ns2.linux-foundation.org.
;; ADDITIONAL SECTION:
ns1.linux-foundation.org. 261 IN A 140.211.169.10
ns2.linux-foundation.org. 262 IN A 140.211.169.11
24
Interactive Query
Default mechanism on DNS
root
server
soict.hust.edu.vn soict.hust.edu.vn
TLD
202.191.56.65 Ask dns.hust.edu.vn server
Default dns.vn
server
Authoritative
DNS server
dns.hust.edu.vn 25
Recursive Query
Extensible option
Root
server
soict.hust.edu.vn
soict.hust.edu.vn 202.191.56.65
TLD
202.191.56.65 server
Default
server dns.vn
soict.hust.edu.vn
202.191.56.65
Authoritative
DNS server
dns.hust.edu.vn
26
HTTP and WWW
Reading 7.3
Computer Networks, Tanenbaum
27
HTTP và Web
Internet before 1990s:
Limited using for government institutes, research centers, ...
Email or FPT services were not suitable for public data sharing
No effective mechanism to link scattered resources in the
Internet
In 1990, Tim Berners-Lee introduce World Wide Web:
Exchange information as hypertext using HTML (Hypertext
Markup Language)
Objects are not needed to be packed as “all in one” as previous
ones
Hypertexts only need to contain links to other objects (located by
URL)
28
Uniform Resource Locator
Areference to a web resource that specifies its
location on a computer network and a
mechanism for retrieving it
protocol://hostname[:port]/directory-path/resource
29
Web and HTTP
First, a quick review…
web page consists of objects, each of which can be stored on
different Web servers
object can be HTML file, JPEG image, Java applet, audio
file,…
web page consists of base HTML-file which includes several
referenced objects, each addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif
time time
Non-persistent HTTP response time = 2RTT+ file transmission time
Send images 1
Close TCP connection
2xRTT 38
Time Time
Operation of HTTP/1.1
Web client Web server
request images 2
Send images 2
Stop-and- Pipeline
request images 10 wait! 39
Time Time
HTTP/1.1 with pipeline
Web client Web server
40
Time Time
HTTP request message
two types of HTTP messages: request, response
HTTP request message:
• ASCII (human-readable format) carriage return character
line-feed character
request line (GET,
GET /index.html HTTP/1.1\r\n
POST, Host: www-net.cs.umass.edu\r\n
HEAD commands) User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
header Accept-Language: en-us,en;q=0.5\r\n
lines Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
Keep-Alive: 115\r\n
Connection: keep-alive\r\n
carriage return, line \r\n
feed at start of line
indicates end of header
lines
lower average end-end delay than with 154 Mbps link (and cheaper too!)
56
Conditional GET client server
in HTTP request
If-modified-since: <date>
HTTP request msg
server: response contains no If-modified-since: <date> object
object if cached copy is up-to- modified
after
date: HTTP response
HTTP/1.0 200 OK <date>
HTTP/1.0 304 Not Modified <data>
O1
O2
O1
O2 O3
O3
O4
O4
O2
O3
O1
O4
66
Electronic mail (E-mail)
MUA (Mail User Agent) Protocols:
Get emails from servers, send Send emails: SMTP-Simple
emails to servers
Mail Transfer Protocol
e.g. Outlook, Thunderbird…
MTA (Mail Transfer Agent): : Receive emails
Contain the mail boxes of user POP – Post Office Protocol
Queue to send emails IMAP – Internet Mail Access
e.g. Sendmail, MS Exchange… Protocol
IMAP IMAP
mail mail
POP POP
user server server user
SMTP
agent agent
SMTP SMTP 67
69
Web Mail
Use Web browser as MUA
MUA and MTA exchange information through HTTP
Mails are stored on servers
E.g.
Gmail,
Hotmail,
Yahoo! Mail, etc.
Today, there are many MTA accessible through web
interface
http://mail.hust.edu.vn
http://mail.soict.hust.edu.vn
70
Mail message format
SMTP: protocol for exchanging e-mail
messages, defined in RFC 531 (like HTTP)
RFC 822 defines syntax for e-mail message
itself (like HTML)
header lines, e.g., header
blank
• To:
line
• From:
• Subject:
these lines, within the body of the email body
message area different from SMTP MAIL
FROM:, RCPT TO: commands!
Body: the “message” , ASCII characters only
72
File Transfer Protocol
73
FTP: File Transfer Protocol
TCP control
connection, port 21
user FTP FTP
interface client server
TCP data
user connection, port 20
75
FTP client
Command line