Chapter 2 Application Layer
2: Application Layer
- Computer Networking:
A Top Down Approach, 5th edition. Jim Kurose, Keith Ross Addison#Wesley, April 2009.
- !
- !"!
! " !# "!!!
- $#%&'(')
*++,-.//+ %&'')))
Chapter 2 Application Layer - - PowerPoint PPT Presentation
Chapter 2 Application Layer
2: Application Layer
A Top Down Approach, 5th edition. Jim Kurose, Keith Ross Addison#Wesley, April 2009.
! " !# "!!!
*++,-.//+ %&'')))
2: Application Layer
SMTP, POP3, IMAP
HTTP
2: Application Layer
client#server
peer#to#peer
FTP SMTP / POP3 / IMAP DNS
socket API
run on (different) end
communicate over network e.g., web server software
application transport network data link physical
2: Application Layer
Network#core devices do
applications on end systems
application transport network data link physical application transport network data link physical
2: Application Layer
SMTP, POP3, IMAP
2: Application Layer
always#on host permanent IP address server farms for
2: Application Layer
communicate with server may be intermittently
may have dynamic IP
do not communicate
2: Application Layer
voice#over#IP P2P application centralized server: finding address of remote
client#client connection: direct (not through
2: Application Layer
chatting between two users is P2P centralized service: client presence
2: Application Layer
sending process shoves
sending process relies on
!""# !""# $
2: Application Layer
HTTP server: 80
2: Application Layer
A: No, many
HTTP server: 80 Mail server: 25
IP address: 128.119.245.12 Port number: 80
e.g., request, response
what fields in messages &
2: Application Layer
meaning of information in
2: Application Layer
2: Application Layer
connection#oriented: setup
reliable transport between
unreliable data transfer
does not provide:
2: Application Layer
flow control: sender won’t
congestion control: throttle
does not provide: timing,
2: Application Layer
app architectures app requirements
2: Application Layer
SMTP, POP3, IMAP
2: Application Layer
Web’s application layer
client/server model
PC running Explorer
2: Application Layer
server: Web server
Server running Apache Web server Mac running Navigator
client initiates TCP
server accepts TCP
server maintains no
2: Application Layer
HTTP messages (application#
TCP connection closed
past history (state) must
if server/client crashes,
2: Application Layer
connection to HTTP server (process) at !!!280
!!!2waiting for TCP connection at port 80. “accepts” connection, notifying < */ $
2: Application Layer
request message (containing URL) into TCP connection
that client wants object ;(< for TCP connection at port 80. “accepts” connection, notifying client
message, forms response message containing requested
into its socket
message containing html file, displays html. Parsing html file, finds 10 referenced jpeg
connection.
2: Application Layer
initiate TCP connection RTT request
2: Application Layer
time to transmit file request file RTT file received ' '
requires 2 RTTs per object OS overhead for each TCP
browsers often open parallel
server leaves connection
subsequent HTTP messages
2: Application Layer
client sends requests as
as little as one RTT for all
ASCII (human#readable format)
2: Application Layer
2: Application Layer
2: Application Layer
uploads file in entity
2: Application Layer
deletes file specified in
2: Application Layer
request succeeded, requested object later in this message
2: Application Layer
requested object moved, new location specified later in
request message not understood by server
requested document not found on this server
Opens TCP connection to port 80 (default HTTP server port) at cis.poly.edu. Anything typed in sent to port 80 at cis.poly.edu 7,!
2: Application Layer
> 7 By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server
2: Application Layer
unique ID entry in backend
entry usual http response
usual http response msg
usual http request msg
access usual http request msg
access
database
2: Application Layer
client
server
2: Application Layer
else cache requests
client
client
server
2: Application Layer
average object size = 100,000
public Internet 1.5 Mbps
2: Application Layer
delay from institutional router
utilization on LAN = 15% utilization on access link = 100% total delay = Internet delay +
access delay + LAN delay = 2 sec + minutes + milliseconds
institutional network 10 Mbps LAN 1.5 Mbps access link
institutional cache
increase bandwidth of access
utilization on LAN = 15% utilization on access link = 15%
public Internet 10 Mbps
2: Application Layer
Total delay = Internet delay +
access delay + LAN delay = 2 sec + msecs + msecs
institutional network 10 Mbps LAN 10 Mbps access link
institutional cache
suppose hit rate is 0.4
40% requests will be
public Internet 1.5 Mbps
2: Application Layer
60% requests satisfied by
utilization of access link
total avg delay = Internet
institutional network 10 Mbps LAN 1.5 Mbps access link
institutional cache
Goal: don’t send object if
cache: specify date of
A$$
HTTP request msg
A$$ BC
HTTP response
2: Application Layer
BC
server: response contains no
!0! ; $
! 0! ;$
HTTP request msg
A$$ BC
HTTP response
!%!!&'
2: Application Layer
SMTP, POP3, IMAP
file transfer FTP server FTP user interface FTP client local file system remote file system user at host
2: Application Layer
client/server model
client: side that initiates transfer (either to/from
server: remote host
ftp: RFC 959 ftp server: port 21
system
FTP client contacts FTP server
client authorized over control
client browses remote
TCP control connection port 21 TCP data connection port 20
2: Application Layer
when server receives file
after transferring one file,
server opens another TCP
control connection: “out of
FTP server maintains “state”:
sent as ASCII text over
.9 #..
status code and phrase (as
00&')
2: Application Layer
99$ retrieves
.&9$ stores
%-
%-"E
2: Application Layer
SMTP, POP3, IMAP
user agents mail servers simple mail transfer
user mailbox
message queue mail server user agent user mail server user agent
2: Application Layer
a.k.a. “mail reader” composing, editing, reading
e.g., Eudora, Outlook, elm,
server user agent user agent mail server user agent user agent
mailbox contains incoming
message queue of outgoing
mail server user agent user mail server user agent
2: Application Layer
client: sending mail
“server”: receiving mail
server user agent user agent mail server user agent user agent
uses TCP to reliably transfer email message from client
direct transfer: sending server to receiving server three phases of transfer
handshaking (greeting)
2: Application Layer
closure
command/response interaction
commands: ASCII text response: status code and phrase
2: Application Layer
user agent mail server mail server user agent 1 2 3 4 5 6
2: Application Layer
2: Application Layer
SMTP uses persistent
SMTP requires message
SMTP server uses
HTTP: pull SMTP: push both have ASCII
2: Application Layer
HTTP: each object
SMTP: multiple objects
header lines, e.g.,
To:
2: Application Layer
From: Subject:
different from SMTP commands!
body
the “message”, ASCII
characters only
SMTP: delivery/storage to receiver’s server
user agent sender’s mail server user agent
receiver’s mail server
2: Application Layer
Mail access protocol: retrieval from server
POP: Post Office Protocol [RFC 1939]
IMAP: Internet Mail Access Protocol [RFC 1730]
HTTP: gmail, Hotmail, Yahoo! Mail, etc.
client commands:
declare username password
server responses
" . +, .%+% . .K&'&0/7 "FF .K&' "7 .K&' $7
2: Application Layer
99
list message numbers retrieve message by
delete :
. " .BC . " "% .BC . "% ": .K&'&0/$$
2: Application Layer
names of folders and
2: Application Layer
SMTP, POP3, IMAP
SSN, name, passport #
IP address (32 bit) #
distributed database
application#layer protocol
2: Application Layer
“name”, e.g.,
note: core Internet
complexity at network’s
Canonical, alias names
2: Application Layer
Canonical, alias names
replicated Web
);=22 ;=2 ;=2 ;=2
> ;=2
2: Application Layer
;=2
contacted by local name server that can not resolve name root name server:
contacts authoritative name server if name mapping not known gets mapping returns mapping to local name server
?;?
2: Application Layer
:24-"2"1)4 "4==@4 =21?!4 "2!4
4A,
2 .5 )" B@*, ";B2 2& ?;? 48?@ :14 1; :2;;?? )@1;
$?.*
responsible for com, org, net, edu, etc, and all
Network Solutions maintains servers for com TLD Educause for edu TLD
2: Application Layer
can be maintained by organization or service
also called “default name server”
2: Application Layer
acts as proxy, forwards query into hierarchy
root DNS server local DNS server
!!
. A 7 TLD DNS server
2: Application Layer
!! !!! !!
* ,
authoritative DNS server !!!
C 5
contacted server
“I don’t know this
root DNS server local DNS server . , C TLD DNS server A
puts burden of name
2: Application Layer
!! !!!
local DNS server
!!
* 7
authoritative DNS server !!!
5
heavy load?
cache entries timeout (disappear) after some
TLD servers typically cached in local name
2: Application Layer
RFC 2136
http://www.ietf.org/html.charters/dnsind#charter.html
is hostname
is alias name for some
2: Application Layer
is domain (e.g.
/ is hostname of
/ is IP address is alias name for some
"is really #$
/ is canonical name
/ is name of mailserver
identification: 16 bit #
2: Application Layer
flags:
query or reply recursion desired recursion available reply is authoritative
2: Application Layer
provide names, IP addresses of authoritative name server
registrar inserts two RRs into com TLD server:
2: Application Layer
app architectures app requirements
2: Application Layer
SMTP, POP3, IMAP
2: Application Layer
File distribution Searching for information Case Study: Skype
Server
2: Application Layer
abundant bandwidth) File, size F
Network (with abundant bandwidth) F
NF/us time
2: Application Layer
Network (with abundant bandwidth) F
2: Application Layer
.0 A A0
4-2
2: Application Layer
/0 * *0 . / */ *0 ./ .0 A/ A0
= 1;
2: Application Layer
trading chunks peer
has no chunks, but will accumulate them over time
2: Application Layer
re#evaluate top 4 every
2: Application Layer
rarest first
newly chosen peer may
“optimistically unchoke”
2: Application Layer
key: ss number; value: human name key: content type; value: IP address key: content type; value: IP address
DB returns values that match the key
Each identifier can be represented by n bits.
eg, key = h(“Led Zeppelin IV”) This is why they call it a distributed “hash” table
Assigning (key, value) pairs to peers.
key = 13, then successor peer = 14 key = 15, then successor peer = 1
I am
***/ ***/ ***/ ***/ ***/ ***/
Who’s resp for key 1110?
Each peer keeps track of IP addresses of predecessor,
Reduced from 6 to 2 messages. Possible to design shortcuts so O(log N) neighbors, O(log
DTo handle peer churn, require
D Each peer periodically pings its
2: Application Layer
NAT prevents an outside
2: Application Layer
Using Alice’s and Bob’s
Each peer initiates
Peers can now
2: Application Layer
SMTP, POP3, IMAP
introduced in BSD4.1 UNIX,
2: Application Layer
client/server paradigm two types of transport
unreliable datagram reliable, byte stream#
2: Application Layer
TCP with buffers, variables socket
controlled by application developer controlled by
system
process TCP with buffers, variables socket
controlled by application developer controlled by
system
server process must first
server must have created
When contacted by client,
allows server to talk with
2: Application Layer
creating client#local TCP
specifying IP address, port
When client creates
source port numbers
!
F !2E 22
TCP connection setup
2: Application Layer
F 2E !2 E2 2E 2
F 2 F 2 ! 2
connection setup
&:
A stream is a sequence of
An input stream is
2: Application Layer
! !
&2
2
socket
An output stream is
2: Application Layer
$GH $GH 4 4I 236!B< I 2H
2: Application Layer
22H J)&:E !J)!"2)2H 22E!2KK,C5+H ;L22E !;L22L2H Create input stream Create client socket, connect to server Create
attached to socket
J)&2E !J)! "2)2"2H E&:@H Create input stream attached to socket Send line
2: Application Layer
2E&2@H 2K&)L12B)?B)KM2H 2H P P Send line to server Read line from server
$GH $GH 4 2I 236!B< I 22H 2>2H
Create
2: Application Layer
22!2E!22,C5+H !I 22E!2H J)&4E !J)! "2)2"2H
Create welcoming socket at port 6789 Wait, on welcoming socket for contact by client Create input stream, attached to socket
;L24E !;L22L2H 2E&4@H Read in line from socket Create output stream, attached to socket
2: Application Layer
4!J>2H P P P Write out line to socket End of while loop, loop back and wait for another client connection
2: Application Layer
SMTP, POP3, IMAP
no handshaking sender explicitly attaches
2: Application Layer
server must extract IP
;2
4!"
2E ;2 2: Application Layer
4!" E<H 2
! 2
&:
Input: receives
packet (recall thatTCP received
2: Application Layer
! 2 :;
packet (recall that TCP sent “byte stream”) thatTCP received “byte stream”) client UDP socket
$GH $GH :; 4I 236!B< I J)&:E
Create input stream
2: Application Layer
!J)!"2)2H ;22E!;2H "" E"J=KKH 36;E!3*/.76H 36;E!3*/.76H 2E&:@H ;EJH
input stream Create client socket Translate hostname to IP address using DNS
; E !; ;;" +5C,H 2 H ; E !; ;;H
Create datagram with data#to#send, length, IP addr, port Send datagram to server
2: Application Layer
2 H 22E !2 ;H 2K&)L12B)?B)KM2H 2H P P
Read datagram from server
$GH $GH :; 2I 236!B< I ;22E!;2+5C,H
Create datagram socket at port 9876
2: Application Layer
36;E!3*/.76H 36;E!3*/.76H ! I ; E !; ;;H 2 H
at port 9876 Create space for received datagram Receive datagram
2E!2 ;H "" E H E H 2>2E:4H
Get IP addr port #, of sender
2: Application Layer
; E !; ;;" H 2 H P P P
Write out datagram to socket End of while loop, loop back and wait for another datagram Create datagram to send to client
client#server P2P hybrid
HTTP FTP SMTP, POP, IMAP DNS
2: Application Layer
reliability, bandwidth,
connection#oriented,
unreliable, datagrams: UDP DNS P2P: BitTorrent, Skype
client requests info or
in#band, out#of#band
2: Application Layer
server responds with
headers: fields giving
data: info being
in#band, out#of#band