Professional Documents
Culture Documents
Application
Layer
A note on the use of these ppt slides:
Were making these slides freely available to all (faculty, students, readers).
Theyre in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lot of work on our part. In return for use, we only
ask the following:
If you use these slides (e.g., in a class) that you mention their source
(after all, wed like people to use our book!)
If you post any slides on a www site, that you note that they are adapted
from (or perhaps identical to) our slides, and note our copyright of this
material.
Thanks and enjoy! JFK/KWR
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Computer
Networking: A
Top Down
Approach
6th edition
Jim Kurose, Keith
Ross
Addison-Wesley
March 2012
Application Layer
2-1
Chapter 2: outline
2.1 principles of
network
applications
2.2 Web and HTTP
2.3 FTP
2.4 electronic mail
SMTP, POP3,
IMAP
2.5 DNS
Application Layer
2-2
Chapter 2: application
layer
our goals:
conceptual,
implementation
aspects of network
application
protocols
transport-layer
service models
client-server
paradigm
peer-to-peer
paradigm
HTTP
FTP
SMTP / POP3 / IMAP
DNS
creating network
applications
socket API
Application Layer
2-3
e-mail
web
text messaging
remote login
P2P file sharing
multi-user network
games
streaming stored
video (YouTube, Hulu,
Netflix)
Application Layer
2-4
application
transport
network
data link
physical
application
transport
network
data link
physical
Application Layer
application
transport
network
data link
physical
2-5
Application architectures
possible structure of applications:
client-server
peer-to-peer (P2P)
Application Layer
2-6
Client-server architecture
server:
always-on host
permanent IP address
data centers for scaling
clients:
client/server
Application Layer
2-7
P2P architecture
no always-on server
arbitrary end systems
directly communicate
peers request service
from other peers,
provide service in
return to other peers
self scalability
new peers bring
new service
capacity, as well as
new service
demands
peers are
intermittently
peer-peer
Application Layer
2-8
Processes communicating
process: program
running within a
host
clients, servers
client process: process that
initiates communication
server process: process
that waits to be contacted
aside: applications
with P2P architectures
have client processes
& server processes
Application Layer
2-9
Sockets
process
socket
application
process
transport
transport
network
network
link
physical
Internet
link
controlled by
app developer
controlled
by OS
physical
Application Layer
2-10
Addressing processes
to receive messages, process
must have identifier
host device has unique 32-bit
IP address
Q: does IP address of host on
which process runs suffice
for identifying the process?
A: no, many
processes can be
running on same
host
more
shortly
Application Layer
2-11
types of messages
exchanged,
e.g., request,
response
message syntax:
what fields in
messages & how
fields are
delineated
message semantics
meaning of
information in
fields
open protocols:
defined in RFCs
allows for interoperability
e.g., HTTP, SMTP
proprietary protocols:
e.g., Skype
Application Layer
2-12
throughput
some apps (e.g.,
multimedia) require
minimum amount of
throughput to be
effective
other apps (elastic
apps) make use of
whatever throughput
they get
security
encryption, data
integrity,
Application Layer
2-13
data loss
throughput
file transfer
e-mail
Web documents
real-time audio/video
no loss
no loss
no loss
loss-tolerant
stored audio/video
interactive games
text messaging
loss-tolerant
loss-tolerant
no loss
elastic
no
elastic
no
elastic
no
audio: 5kbps-1Mbps yes, 100s msec
video:10kbps-5Mbps
same as above
yes, few secs
few kbps up
yes, 100s msec
elastic
yes and no
Application Layer
time sensitive
2-14
reliable transport
between sending and
receiving process
flow control: sender
wont overwhelm
receiver
congestion control:
throttle sender when
network overloaded
does not provide:
timing, minimum
throughput guarantee,
security
connection-oriented:
setup required
between client and
UDP service:
unreliable data transfer
between sending and
receiving process
does not provide: reliability,
flow control, congestion
control, timing,
throughput guarantee,
security, or connection
setup,
Q: why bother? Why is
there a UDP?
Application Layer
2-15
application
layer protocol
underlying
transport protocol
TCP
TCP
TCP
TCP
TCP or UDP
TCP or UDP
Application Layer
2-16
Securing TCP
TCP & UDP
no encryption
cleartext passwds
sent into socket
traverse Internet
in cleartext
SSL
provides
encrypted TCP
connection
data integrity
2-17
Chapter 2: outline
2.1 principles of
network
applications
app architectures
app requirements
2.5 DNS
Application Layer
2-18
path name
Application Layer
2-19
HTTP overview
HTTP: hypertext
transfer protocol
Webs application
layer protocol
client/server model
client: browser
that requests,
receives, (using
HTTP protocol)
and displays
Web objects
server: Web
server sends
(using HTTP
protocol) objects
in response to
requests
PC running
Firefox browser
HT
TP
r
HT
TP
TP
T
H
equ
est
res
p
ons
e
t
es
u
req
re
P
T
HT
ns
o
sp
server
running
Apache Web
server
iphone running
Safari browser
Application Layer
2-20
HTTP is stateless
server maintains no
information about
past client requests
aside
protocols that maintain
state are complex!
2-21
HTTP connections
non-persistent HTTP persistent HTTP
at most one
multiple objects can be
sent over single TCP
object sent over
connection between
TCP connection
client, server
connection then
closed
downloading
multiple objects
required multiple
connections
Application Layer
2-22
Non-persistent HTTP
suppose user enters URL:
www.someSchool.edu/someDepartment/home.index
(contains text,
references to 10
jpeg images)
2-23
time
Application Layer
2-24
initiate TCP
connection
RTT
request
file
time to
transmit
file
RTT
file
received
time
Application Layer
time
2-25
Persistent HTTP
non-persistent HTTP
issues:
persistent HTTP:
server leaves connection
open after sending
response
subsequent HTTP messages
between same
client/server sent over
open connection
client sends requests as soon
as it encounters a
referenced object
as little as one RTT for all
the referenced objects
Application Layer
2-26
User-Agent: Firefox/3.6.10\r\n
headerAccept: text/html,application/xhtml+xml\r\n
Accept-Language: en-us,en;q=0.5\r\n
linesAccept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
Keep-Alive: 115\r\n
carriage return,
Connection: keep-alive\r\n
line feed at start
\r\n
of line indicates
end of header lines
Application Layer
2-27
sp
URL
sp
value
version
cr
lf
value
cr
lf
request
line
header
lines
~
~
~
~
~
~
cr
lf
lf
entity body
~
~
body
Application Layer
2-28
URL method:
uses GET method
input is uploaded in URL
field of request line:
www.somesite.com/animalsearch?monkeys&banana
Application Layer
2-29
Method
types
HTTP/1.0:
GET
POST
HEAD
asks server to
leave requested
object out of
response
HTTP/1.1:
GET, POST, HEAD
PUT
uploads file in
entity body to
path specified in
URL field
DELETE
deletes file
specified in the
URL field
Application Layer
2-30
header
lines
data, e.g.,
requested
HTML file
Application Layer
2-31
200 OK
request succeeded, requested object later in this msg
2-32
2-33
2-34
server
usual http request msg
cookie file
ebay 8734
amazon 1678
set-cookie: 1678
cookie: 1678
Amazon server
creates ID
1678 for user create backend
entry database
cookiespecific
action
access
access
usual http request msg
cookie: 1678
cookiespecific
action
Application Layer
2-35
Cookies (continued)
what cookies can
be used for:
authorization
shopping carts
recommendations
user session state
(Web e-mail)
aside
cookies and privacy:
cookies permit sites
to learn a lot about
you
you may supply
name and e-mail to
sites
2-36
HT
TP
r
proxy
server
equ
HT
est
client TP
res
pon
se
t
es
u
req
e
P
ns
T
o
T
p
H
es
r
TP
T
H
st
e
u
req
P
T
se
n
o
HT
p
origin
res
P
T
server
HT
client
origin
server
Application Layer
2-37
cache acts as
both client and
server
server for original
requesting client
client to origin server
typically cache is
installed by ISP
(university,
company,
residential ISP)
2-38
Caching example:
assumptions:
consequences:
origin
servers
public
Internet
1.54 Mbps
access link
institutional
network
1 Gbps LAN
2-39
consequences:
9.9%
public
Internet
origin
servers
1.54 Mbps
154 Mbps
access link
institutional
network
1 Gbps LAN
2-40
consequences:?
origin
servers
public
Internet
1.54 Mbps
access link
institutional
network
LAN utilization:
15%
?
access link utilization = 100%
Howdelay
to compute
total
= Internetlink
delay +
access
delay + LAN
delay
utilization,
delay?
= 2 sec + minutes + usecs
1 Gbps LAN
local web
cache
Application Layer
2-41
0.4
access
origin
servers
public
Internet
link utilization:
1.54 Mbps
access link
institutional
network
1 Gbps LAN
local web
cache
Application Layer
2-42
Conditional GET
HTTP response
HTTP/1.0
304 Not Modified
If-modified-since: <date>
If-modified-since:
<date>
HTTP response
server: response
contains no object if
cached copy is up-
HTTP/1.0 200 OK
object
not
modified
before
<date>
object
modified
after
<date>
<data>
Application Layer
2-43
Chapter 2: outline
2.1 principles of
network
applications
app architectures
app requirements
2.5 DNS
Application Layer
2-44
file transfer
FTP
client
FTP
server
remote file
system
local file
system
Application Layer
2-45
FTP
client
FTP
server
2-46
RETR filename
retrieves (gets) file
STOR filename
stores (puts) file onto
remote host
2-47