Lecture#09-13 Application Layer (Computer Networks Part-2)
Lecture#09-13 Application Layer (Computer Networks Part-2)
1
2: Application Layer
2
2: Application Layer
Client-server
Peer-to-peer (P2P)
Hybrid of client-server and P2P
3
2: Application Layer
server:
always-on host
permanent IP address
server farms for scaling
clients:
communicate with server
may be intermittently
connected
may have dynamic IP
addresses
do not communicate
directly with each other
4
2: Application Layer
no always-on server
arbitrary end systems
directly communicate
peers are intermittently
connected and change IP
addresses
example: Gnutella
5
2: Application Layer
Skype
Internet telephony app
Finding address of remote party: centralized server(s)
Client-client connection is direct (not through server)
Instant messaging
Chatting between two users is P2P
Presence detection/location centralized:
User registers its IP address with central server when it comes online
User contacts central server to find IP addresses of buddies
6
2: Application Layer
7
2: Application Layer
host or host or
process sends/receives server server
messages to/from its socket
controlled by
socket analogous to door app developer
process process
sending process shoves(push)
message out door socket socket
sending process relies on TCP with TCP with
buffers, Internet buffers,
transport infrastructure on other
variables variables
side of door which brings
message to socket at receiving
process controlled
by OS
to receive messages,
process must have
identifier
host device has unique32-
bit IP address
Q: does IP address of host
on which process runs
suffice for identifying the
process?
9
2: Application Layer
12
2: Application Layer
13
2: Application Layer
14
2: Application Layer
Application Underlying
Application layer protocol transport protocol
15
2: Application Layer
16
2: Application Layer
Object can be HTML file, JPEG image, Java applet, audio file,…
referenced objects
Each object is addressable by a URL
Example URL:
www.someschool.edu/someDept/pic.gif
17
2: Application Layer
18
2: Application Layer
19
2: Application Layer
20
2: Application Layer
(contains text,
Suppose user enters URL www.someSchool.edu/someDepartment/home.index
references to 10
jpeg images)
time
21
2: Application Layer
22
2: Application Layer
23
2: Application Layer
24
2: Application Layer
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
Carriage return,
line feed (extra carriage return, line feed)
indicates end
of message
25
2: Application Layer
26
2: Application Layer
www.somesite.com/animalsearch?monkeys&banana
27
2: Application Layer
HTTP/1.0 HTTP/1.1
GET GET, POST, HEAD
POST PUT
HEAD
uploads file in entity body to path
specified in URL field
asks server to leave requested
object out of response
DELETE
deletes file specified in the URL
field
28
2: Application Layer
29
2: Application Layer
status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection close
Date: Thu, 06 Aug 1998 12:00:15 GMT
header Server: Apache/1.3.0 (Unix)
lines Last-Modified: Mon, 22 Jun 1998 …...
Content-Length: 6821
Content-Type: text/html
31
2: Application Layer
33
2: Application Layer
34
2: Application Layer
client server
Cookie file usual http request msg server ne
da try i
ta b n b
usual http response + creates ID as ac
e ke
ebay: 8734 Set-cookie: 1678 1678 for user nd
Cookie file
usual http request msg
amazon: 1678 cookie: 1678 cookie- s s
ebay: 8734 specific acce
usual http response msg action
s
one week later:
s
ce
ac
usual http request msg
Cookie file cookie-
cookie: 1678
amazon: 1678 spectific
ebay: 8734 usual http response msg action
35
2: Application Layer
aside
What cookies can bring: Cookies and privacy:
authorization cookies permit sites to
shopping carts learn a lot about you
recommendations you may supply name
user session state (Web e-mail) and e-mail to sites
client
origin
server
37
2: Application Layer
38
2: Application Layer
Assumptions origin
average object size = 100,000 bits servers
avg. request rate from institution’s
public
browsers to origin servers = 15/sec
Internet
delay from access link router to any origin
server and back to router = 2 sec
Consequences
Utilization or traffic intensity, I=∆β, where 1.5 Mbps
β is an average arrival rate, ∆ is an average access link
transmission time which is L/R. institutional
utilization on LAN = 15% and utilization network
10 Mbps LAN
on access link = 100%
total delay = Internet delay + access delay
+ LAN delay
Average delay=∆/(1-I),
= 2 sec + minutes + milliseconds
39
2: Application Layer
origin
Possible solution
servers
increase bandwidth of access link
public
to, say, 10 Mbps
Internet
Consequences
utilization on LAN = 15%
utilization on access link = 15%
10 Mbps
Total delay = Internet delay + access access link
delay + LAN delay
institutional
= 2 sec + msecs + msecs network
10 Mbps LAN
often a costly upgrade
40
2: Application Layer
origin
Install cache servers
suppose hit rate is .4 public
Consequence Internet
40% requests will be satisfied
almost immediately
60% requests satisfied by origin
server 10 Mbps
access link
utilization of access link reduced
to 60%, resulting in negligible institutional
delays (say 10 msec) network
10 Mbps LAN
total avg delay = Internet delay
+ access delay + LAN delay
= .6*(2.01) secs
+ .4*milliseconds = 1.21 secs
institutional
cache
41
2: Application Layer
43
2: Application Layer
44
2: Application Layer
45
2: Application Layer
46
2: Application Layer
47
2: Application Layer
outgoing
message queue
user mailbox
user
Three major components: agent
user agents mail
user
mail servers server
agent
simple mail transfer protocol: SMTP mail
SMTP server user
User Agent
SMTP agent
user
Mail Servers agent
mailbox contains incoming mail
user
messages for user server
agent
message queue of outgoing (to
SMTP mail
be sent) mail messages
server user
SMTP protocol between mail
servers to send email messages
SMTP agent
49
2: Application Layer
transfer of messages
closure
command/response interaction
commands: ASCII text
50
2: Application Layer
1 mail
mail
server user
user server
2 agent
agent 3 6
4 5
51
2: Application Layer
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you
C: MAIL FROM: <[email protected]>
S: 250 [email protected]... Sender ok
C: RCPT TO: <[email protected]>
S: 250 [email protected] ... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection
52
2: Application Layer
telnet servername 25
see 220 reply from server
enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands
above lets you send email without using email client (reader)
53
2: Application Layer
54
2: Application Layer
From:
Subject:
55
2: Application Layer
From: [email protected]
MIME version To: [email protected]
Subject: Picture of yummy crepe.
method used MIME-Version: 1.0
to encode data Content-Transfer-Encoding: base64
Content-Type: image/jpeg
multimedia data
type, subtype, base64 encoded data .....
parameter declaration .........................
......base64 encoded data
encoded data
56
2: Application Layer
57
2: Application Layer
sessions
59
2: Application Layer
60
2: Application Layer
“edge”
61
2: Application Layer
62
2: Application Layer
63
2: Application Layer
gets mapping
a Verisign, Dulles, VA
c Cogent, Herndon, VA (also Los Angeles)
d U Maryland College Park, MD k RIPE London (also Amsterdam,
g US DoD Vienna, VA Frankfurt)
h ARL Aberdeen, MD i Autonomica, Stockholm (plus 3
j Verisign, ( 11 locations) other locations)
m WIDE Tokyo
e NASA Mt View, CA
f Internet Software C. Palo Alto,
CA (and 17 other locations)
13 root name
servers worldwide
b USC-ISI Marina del Rey, CA
l ICANN Los Angeles, CA
64
2: Application Layer
66
2: Application Layer
gaia.cs.umass.edu
67
2: Application Layer
recursive query: 2 3
puts burden of name
resolution on 7 6
contacted name TLD DNS server
server
heavy load?
local DNS server
dns.poly.edu 5 4
1 8
gaia.cs.umass.edu
68
2: Application Layer
69
2: Application Layer
Type=A Type=CNAME
name is hostname name is alias name for some
value is IP address “canonical” (the real) name
www.ibm.com is really
Type=NS
servereast.backup2.ibm.com
name is domain (e.g. foo.com)
value is canonical name
value is hostname of
authoritative name server for
this domain Type=MX
value is name of mailserver
associated with name
70
2: Application Layer
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
71
2: Application Layer
RRs in response
to query
records for
authoritative servers
additional “helpful”
info that may be used
72
2: Application Layer
73
2: Application Layer
74