CS代考 RFC 822: standard for text message format:

Computer Networking and Applications
Application Layer
• Application layer protocols define
– what messages are exchanged

Copyright By PowCoder代写 加微信 powcoder

– the syntax of the messages
– the semantics of the messages
– how/when to exchange messages
– note the interaction is defined, not the application itself!
• We will examine three network applications and their protocols
– E-mail (SMTP – simple transport protocol) (Read up in the text
– the Web (HTTP – HyperText Transfer Protocol)
– Domain Name Service (DNS)
– P2P file sharing
• But first we’ll look at current application architectures…
Kurose & Ross: Ch 2

Computer Networking and Applications
PC running Firefox browser
Appache Web Server
iphone running Safari browser

Computer Networking and Applications
Models of Interaction – central storage of information in always on
• Client – Server server
– distinction between client which receives service and server which provides service
– note that it is possible for a host to act as both a client and as a server in different interactions.
– Web, e-mail, FTP
• Peer to Peer
– distributed storage of information
– no clear distinction between clients and servers. Hosts share typically equal control of processing and data
– Peers dynamically join and leave
– Bit Torrent
client/server

Computer Networking and Applications
Electronic mail
Three major components:
• user agents
• mail servers
• simple mail transfer protocol:
User Agent
• a.k.a. “mail reader”
• composing, editing, reading
mail messages
• e.g., Outlook, Thunderbird, iPhone mail client
• outgoing, incoming messages stored on server
outgoing message queue
user mailbox
user agent
mail server
user agent
mail server
user agent
user agent
mail server
user agent
user agent

Computer Networking and Applications
Electronic mail: mail servers
mail servers:
• mailbox contains incoming messages for user
• message queue of outgoing (to be sent) mail messages
• SMTP protocol between mail servers to send email messages
– client: sending mail server
– “server”: receiving mail server. TCP port 25
mail server
user agent
user agent
mail server
mail server
user agent
user agent
user agent
user agent

Computer Networking and Applications
Mail message format
SMTP: protocol for exchanging email msgs
RFC 822: standard for text message format:
• header lines, e.g., – To:
– From: – Subject:
different from SMTP MAIL FROM, RCPT TO: commands!
• Body: the “message” – ASCII characters only
blank line

Computer Networking and Applications
Sample smtp interaction
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM:
S: 250 Sender ok
C: RCPT TO:
h a n d s h a k
S: 250 … Recipient ok i
S: 354 Enter mail, end with “.” on a line by itself C: Do you like ketchup?
C: How about pickles?
S: 250 Message accepted for delivery
S: 221 hamburger.edu closing connection

Computer Networking and Applications
Mail access protocols
sender’s mail server
mail access protocol
(e.g., POP, IMAP)
user agent
user agent
• SMTP: delivery/storage to receiver’s server
• mail access protocol: retrieval from server
– POP: Post Office Protocol [RFC 1939]: authorization, download
– IMAP: Internet Mail Access Protocol [RFC 1730]: more features, including manipulation of stored msgs on server
– HTTP: gmail, Hotmail, Yahoo! Mail, etc.
receiver’s mail server

Computer Networking and Applications
The World Wide Web
– HEAD (meta data)
– POST (send data to server)
– PUT, OPTIONS,DELETE,TRACE,CONNECT
HTTP 1.0 – RFC 1945 HTTP 1.1 – RFC 2616
• Client-Server
• requests
– GET (get a URL)
PC running Firefox browser
• responses
– “nnn message
– 1xx Informational – 2xx Success
– 3xx Redirection
– 4xx Client Error
– 5xx Server Error
iphone running Safari browser

Computer Networking and Applications
GET /somedir/page.html HTTP/1.0 User-agent: Mozilla/4.0
Accept: text/html, image/gif,image/jpeg Accept-language:fr
HTTP request format
header lines
Carriage return, line feed indicates end of message
request line (GET, etc commands)
(extra carriage return, line feed)
©Kurose & Ross 2001

Computer Networking and Applications
status line (protocol status code
status phrase) header
HTTP response format
HTTP/1.0 200 OK
Date: Thu, 06 Aug 1998 12:00:15 GMT
Server: Apache/1.3.0 (Unix)
Last-Modified: Mon, 22 Jun 1998 ……
Content-Length: 6821
Content-Type: text/html
data data data data data …
data, e.g., requested
status code
header field name
header field name
Entity Body

Computer Networking and Applications
Trying out network applications (client side) for yourself
1. Telnet to your favorite server (web server in this example):
telnet www.cs.adelaide.edu.au 80
Opens TCP connection to port 80 (default HTTP server port) at www.cs.adelaide.edu.au
Anything typed in sent
to port 80 at www.cs.adelaide.edu.au
2. Type in the protocol request (a GET HTTP request):
GET /index.html HTTP/1.1 Host: www.cs.adelaide.edu.au
By typing this in (hit carriage return twice), you send
this minimal (but complete) GET request to HTTP server
3. Look at response message sent by server!
You can do the same with a mail server on port 25.

Computer Networking and Applications
Improving performance – Persistent HTTP
Nonpersistent HTTP issues:
• HTTP/1.0
• requires 2 RTTs per object
• OS overhead for each TCP connection
• browsers often open parallel TCP connections to fetch referenced objects
Persistent HTTP
• server leaves connection open after sending response
• subsequent HTTP messages between same client/server sent over open connection
Persistent without pipelining:
• client issues new request only when previous response has been received
• one RTT for each referenced object
Persistent with pipelining:
• default in HTTP/1.1
• Often not turned on in browsers
• client sends requests as soon as it encounters a referenced object
• as little as one RTT for all the referenced objects

Computer Networking and Applications
SMTP: final words
• SMTP uses persistent connections
• SMTP requires message (header & body) to be in 7- bit ASCII
• SMTP server uses CRLF.CRLF to determine
end of message
comparison with HTTP:
• HTTP: pull
• SMTP: push
• both have ASCII command/response interaction, status codes
• HTTP: each object encapsulated in its own response msg
• SMTP: multiple objects sent in multipart msg

Computer Networking and Applications
Goal: satisfy client request without involving origin server • user sets browser: Web
accesses via cache
• browser sends all HTTP requests to cache
– object in cache: cache returns object
– else cache requests object from origin server, then returns object to client
• Cache acts as both client and server
• Typically cache is installed by ISP (university, company, residential ISP)
proxy server
Web caches (proxy server)
origin server
Reduce response time for client request. Reduce traffic on an institution’s access link.
Internet dense with caches: enables “poor” content providers to effectively deliver content (but so does P2P file sharing)
origin server
Why Web caching?

Computer Networking and Applications
Caching example:
assumptions:
 avg object size: 1Mbit
 avg request rate from browsers to origin
servers:15/sec
 avg data rate to browsers: 15
 RTT from the Internet side of the access link to an origin server: 2 seconds
 access link rate: 15 Mbps
origin servers
consequences:
public Internet
15 Mbps access link
 LANutilization:15% problem!
 access link utilization = 100%
 total delay = Internet delay + access
institutional network
100 Mbps LAN
delay + LAN delay
= 2 sec + minutes + usecs

Computer Networking and Applications
Caching example: fatter access link
assumptions:
 avg object size: 1Mbit
 avg request rate from browsers to origin
servers:15/sec
 avg data rate to browsers: 15 Mbps
 RTT from institutional router to any
origin servers
origin server: 2 sec
 access link rate: 15 Mbps
consequences:
 LANutilization:15%
 access link utilization = 100%
 total delay = Internet delay + access
delay + LAN delay
= 2 sec + minutes + usecs
public Internet
15 Mbps access link
institutional network
100 Mbps LAN
Cost: increased access link speed (not cheap!)

Computer Networking and Applications
Caching example: install local cache
Calculating access link utilization, delay with cache:
• suppose cache hit rate is 0.4
– 40% requests satisfied at cache, 60%
requests satisfied at origin
origin servers
public Internet
access link utilization:
 60% of requests use access link
15 Mbps access link
data rate to browsers over access link = 0.6*15 Mbps = 9 Mbps
institutional network
 utilization = 9 Mbps/15 Mbps = 60%
100 Mbps LAN
local web cache
Note: We neglected to LAN delay and access link delay as these are negligile
total delay
 = 0.6 * (delay fetching from origin servers) +0.4
* (delay when satisfied at cache or LAN delay)
 = 0.6 (2.02) + 0.4 (~10 ms)
 = ~ 1.2 secs
 less than with 100 Mbps link (and cheaper too!)

Computer Networking and Applications
How do processes (browser and webserver) communicate? (socket programming)
See Sockets.PDF (next week)

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com