Professional Documents
Culture Documents
Lớp Application 3
Kiến trúc phân tầng
Ứng dụng mạng
Ứng dụng application
transport
Lớp Application 13
Web and HTTP
First some jargon
Web page consists of objects
file,…
Web page consists of base HTML-file which includes several
referenced objects
Each object is addressable by a URL
Example URL:
www.someschool.edu/someDept/pic.gif
15
HTTP overview (continued)
Uses TCP: HTTP is “stateless”
client initiates TCP connection server maintains no
(creates socket) to server, port 80 information about past
server accepts TCP connection client requests
from client aside
HTTP messages (application-layer Protocols that maintain “state” are
protocol messages) exchanged complex!
between browser (HTTP client) past history (state) must be
and Web server (HTTP server) maintained
TCP connection closed if server/client crashes, their
views of “state” may be
inconsistent, must be reconciled
16
HTTP request message
request line
(GET, POST, GET /somedir/page.html HTTP/1.1
HEAD commands) Host: www.someschool.edu
User-agent: Mozilla/4.0
header Connection: close
lines Accept-language:fr
www.somesite.com/animalsearch?monkeys&banana
19
Trying out HTTP (client side) for yourself
20
2.3 FTP
Lớp Application 21
FTP: the file transfer protocol
22
FTP: separate control, data connections
23
2.4 Electronic Mail
Lớp Application 24
outgoing
Electronic Mail message queue
user mailbox
user
Three major components: agent
user agents mail
user
server
mail servers agent
simple mail transfer protocol: SMTP SMTP
mail
server user
User Agent SMTP agent
a.k.a. “mail reader”
SMTP
composing, editing, reading mail user
mail
messages agent
server
e.g., Eudora, Outlook, elm, Mozilla
Thunderbird user
agent
outgoing, incoming messages stored user
on server agent
25
Electronic Mail: mail servers
user
Mail Servers agent
mailbox contains incoming mail
user
messages for user server
agent
message queue of outgoing (to SMTP
be sent) mail messages mail
server user
SMTP protocol between mail SMTP agent
servers to send email messages
client: sending mail server
SMTP
mail user
“server”: receiving mail server agent
server
user
agent
user
agent
26
Electronic Mail: SMTP [RFC 2821]
transfer of messages
closure
command/response interaction
commands: ASCII text
27
Scenario: Alice sends message to Bob
1 mail
mail
server user
user server
2 agent
agent 3 6
4 5
28
Mail message format
29
Mail access protocols
access
user
SMTP SMTP protocol
agent
user
agent
30
POP3 protocol
S: +OK POP3 server ready
C: user bob
authorization phase S: +OK
C: pass hungry
client commands:
S: +OK user successfully logged on
user: declare username
C: list
pass: password
S: 1 498
server responses S: 2 912
+OK S: .
-ERR
C: retr 1
S: <message 1 contents>
transaction phase, client: S: .
list: list message numbers C: dele 1
retr: retrieve message by C: retr 2
number S: <message 1 contents>
S: .
dele: delete C: dele 2
quit C: quit
S: +OK POP3 server signing off
31
2.5 DNS
Lớp Application 32
Domain Name
Domain Name
FQDN: Fully Qualified Domain Name
Làtên của một máy tính hay của một mạng máy tính,
sử dụng tên (chữ cái, chữ số)
◼ www.uef.edu.vn
◼ www.vnexpress.net
◼ www.moet.gov.vn
Không gian tên miền
Tên và địa chỉ
Trước khi truyền tin, máy trạm phải được xác định:
Bởi một địa chỉ IP, hoặc
Bởi một tên miền (thuận tiện cho NSD)
Tên:
Độ dài thay đổi
Dễ nhớ cho con người
Không liên quan tới vị trí vật lý của máy
Địa chỉ:
Độ dài cố định
Dễ cho máy tính để xử lý
Liên quan tói vấn đề chọn đường
Chuyển đổi địa chỉ
Cơ chế cho phép tìm một địa chỉ IP từ một tên miền và ngược lại
Máy chủ tên miền (DNS):
Một phương thức được sử dụng để chuyển đổi địa chỉ
Được sử dụng rộng rãi trên Internet
Chuyển đổi địa chỉ - ví dụ
Công cụ nslookup
Nhập tham số www.hedspi.hut.edu.vn
Chuyển đổi “Tên Địa chỉ” được thực hiện
Lệnh nslookup
nslookup www.hedspi.hut.edu.vn
ARP: Chuyển đổi địa chỉ vật lý – địa chỉ IP
Ví dụ ARP table
DNS: Domain Name System
40
DNS
41
Distributed, Hierarchical Database
www.amazon.com
42
DNS: Root name servers
gets mapping
a Verisign, Dulles, VA
c Cogent, Herndon, VA (also LA)
d U Maryland College Park, MD k RIPE London (also 16 other locations)
g US DoD Vienna, VA
h ARL Aberdeen, MD i Autonomica, Stockholm (plus
j Verisign, ( 21 locations) 28 other locations)
e NASA Mt View, CA m WIDE Tokyo (also Seoul,
f Internet Software C. Palo Alto, Paris, SF)
CA (and 36 other locations)
43
Local Name Server
does not strictly belong to hierarchy
each ISP (residential ISP, company, university) has
one.
also called “default name server”
when host makes DNS query, query is sent to its
local DNS server
acts as proxy, forwards query into hierarchy
DNS name resolution example
root DNS server
Host at cis.poly.edu
wants IP address for
2
gaia.cs.umass.edu 3
TLD DNS server
iterated query: 4
contacted server replies
5
with name of server to
contact local DNS server
“I don’t know this name, dns.poly.edu
but ask this server” 1 8
7 6
1 8
gaia.cs.umass.edu
DNS protocol, messages
DNS protocol : query and reply messages, both with same message format
msg header
identification: 16 bit # for
query, reply to query uses
same #
flags:
❖ query or reply
❖ recursion desired
❖ recursion available
❖ reply is authoritative
47
DNS protocol, messages
RRs in response
to query
records for
authoritative servers
additional “helpful”
info that may be used
48
Summary
our study of network apps now complete!
specific protocols:
application architectures
❖ HTTP
client-server ❖ FTP
P2P ❖ SMTP, POP, IMAP
hybrid ❖ DNS
application service requirements: ❖ P2P: BitTorrent, Skype
reliability, bandwidth, delay
Internet transport service model
connection-oriented, reliable: TCP
unreliable, datagrams: UDP
Summary
Most importantly: learned about protocols
typical request/reply Important themes:
message exchange: control vs. data msgs
❖ in-band, out-of-band
client requests info or service centralized vs. decentralized
server responds with data, stateless vs. stateful
status code reliable vs. unreliable msg transfer
message formats: “complexity at network edge”
headers: fields giving info
about data
data: info being
communicated
50