csci5211: Computer Networks and Data Communications

Download Report

Transcript csci5211: Computer Networks and Data Communications

Review On Last Lecture
• Introduction to Computer Networks
– Connectivity, statistical multiplexing
• The Network Architecture
– OSI vs. Internet
– Logical vs. Physical communications; Encapulation
– Multiplexing and Demultiplexing
• Introduction to the Internet
– The loosely hierarchical structure
– Addressing issues
• Performance parameters: Bandwidth, Delay, RTT,
Delay Bandwidth Product, bit length
Csci 183/183W/232 Computer
Networks
Network Applications
1
Application Layer
Building Networked Applications/Systems
–
–
Naming Issues
Application Architectures
• Client-Server vs. Peer-to-Peer
– Look-up Systems
• Hierarchical: DNS
• Peer-to-Peer: Unstructured vs. Structured
– API and Transport Layer Services: TCP, UDP, RTP
– Example Applications and Application Layer Protocols
• HTTP, SMTP, SIP, …
– Content Distribution Networks (read yourself)
Readings:
Section 1.4
Chapter 9: 9.1 and 9.4, Chapter 7 (read yourself)
Csci 183/183W/232 Computer
Networks
Network Applications
2
Objectives
• Understand
– Service requirements applications place on network
infrastructure
– Protocols applications use to implement applications
• Conceptual + implementation aspects of network
application protocols
– client server paradigm
– peer-to-peer paradigm (DHT)
• Learn about protocols by examining popular
application-level protocols
– DNS
– Wide Wide Web, Web Caching
– Electronic Mail
Csci 183/183W/232 Computer
Networks
Network Applications
3
Common Applications and Requirements
“Non-Interactive” Data Transfer of Various Types
•
•
•
web download/upload, ftp of text files, images, audio, video, etc.
sending or retrieving of emails (from mail servers)
file sharing, podcasting, …
Requirements
Desirables/Comments
• 100% reliability (no data loss)
• fast response time desirable
-- may be relaxed for images/audio/video • bursty and “bandwidth-elastic”
-- allocate as much as possible
“Interactive” Text-based Applications
•
•
•
telnet and other remote terminal operations
instant messaging
interactive on-line gaming, ……
Desirables/Comments
Requirements
• 100% reliability (no data loss)
• short message delay (time scale ~ 10s?)
Csci 183/183W/232 Computer
Networks
• generally require low bandwidth
• bursty
Network Applications
4
Common Applications and Requirements…
Streaming (Stored) Audio/Video
Desirables/Comments
• Internet radio
• minimal bandwidth needed
• IPTV/video playback on-demand
• as good quality as possible
Requirements
(but more bw maybe wasteful!)
• can tolerate some data loss
• fast start-up desirable
• can tolerate some “start-up” delay
• delay-sensitive, threshold for minimal quality
“Real-Time” or “Interactive” Audio/Video Applications
• VoIP, audio/video conferencing
Desirables/Comments
• real-time audio/video broadcasting
• Interactive multimedia on-line gaming • minimal bandwidth needed
• as good quality as possible
Requirements
(but more bw maybe
• can tolerate some data loss
wasteful!)
• delay-sensitive, threshold for minimal quality
Csci 183/183W/232 Computer
Networks
Network Applications
5
Summary: Application Requirements
Data loss
• some apps (e.g., audio) can
tolerate some loss
• other apps (e.g., file
transfer, telnet) require
100% reliable data transfer
Bandwidth
• some apps (e.g., multimedia)
require minimum amount of
bandwidth to be “effective”
•
Timing
• some apps (e.g., Internet
telephony, interactive
games) require low delay to
be “effective”
other apps (“elastic apps”)
make use of whatever
bandwidth they get
Csci 183/183W/232 Computer
Networks
Network Applications
6
Transport service requirements of common apps
Data loss
Bandwidth
Time Sensitive
file transfer
e-mail
Web documents
real-time audio/video
no loss
no loss
loss-tolerant
loss-tolerant
no
no
no
yes, 100’s msec
stored audio/video
interactive games
financial apps
loss-tolerant
loss-tolerant
no loss
elastic
elastic
elastic
audio: 5Kb-1Mb
video:10Kb-5Mb
same as above
few Kbps up
elastic
Application
Csci 183/183W/232 Computer
Networks
Network Applications
yes, few secs
yes, 100’s msec
yes and no
7
Network Transport Services
Functionalities
• end host to end host communication services
• “packaging” what network provides to serve common
application needs
• introduce common abstractions and service interfaces
What network (Internet) provides: What applications want:
“Best-Effort” Datagram Service
• data consist of bytestream with application
• data delivered in chunks (packets)
semantics
• no guarantee of delivery time
• many want reliable data
– try to deliver as fast as possible
delivery (no data loss)
• may be delivered out of order
• some want timely data
• may be lost
delivery
– no effort made to recover them
• ….
• may even be duplicated
Csci 183/183W/232 Computer
Networks
Network Applications
8
What Transport Services?
Network provides “shoddy” service, what “packaging”
services can we provide end-to-end?
Unreliable, datagram service: Reliable, “virtual pipe” service :
UDP
TCP
•
•
minimal “packaging” except
service interfaces &
mux/demux functions
leave everything to apps
Unreliable, real-time service:
RTP/RTCP (wrapped over UDP)
•
ordered media stream
•
timestamp
•
other info
– for loss detection, no recovery
•
connection-oriented
•
reliable data delivery
•
flow and congestion control
– to assist playback and other ops
– maintain connection states at end hosts
– ordered byte streams within a
connection
– re-order data, recover lost data, remove
duplicates
– no effort made to recover the packets
with error
– Try not overflow receiver or network
– time, inter-media sync., loss/delay reports, …
Csci 183/183W/232 Computer
Networks
Network Applications
9
Internet apps: their protocols and transport
protocols
Application
e-mail
remote terminal access
Web
file transfer
streaming multimedia
remote file server
Internet telephony
Csci 183/183W/232 Computer
Networks
Application
layer protocol
Underlying
transport protocol
smtp [RFC 821]
telnet [RFC 854]
http [RFC 2068]
ftp [RFC 959]
proprietary
(e.g. RealNetworks)
NFS
proprietary
(e.g., Vonage)
TCP
TCP
TCP
TCP
TCP or UDP
Network Applications
TCP or UDP
typically RTP/UDP
10
Apps, Transport Services and Network
TCP
UDP
RTP
de-multiplex using port no.
IP address identifying host interface
Csci 183/183W/232 Computer
Networks
Network Applications
11
Applications and Application-Layer Protocols
Application: communicating,
distributed processes
– running in network hosts in
“user space”
– exchange messages to
implement app
– e.g., email, file transfer, the
Web
application
transport
network
data link
physical
Application-layer protocols
– one “piece” of an app
– define messages exchanged
by apps and actions taken
– use services provided by lower
layer protocols
Csci 183/183W/232 Computer
Networks
application
transport
network
data link
physical
Network Applications
application
transport
network
data link
physical
12
Processes communicating
Process: program running
within a host.
• within same host, two
processes communicate
using inter-process
communication (defined
by OS).
• processes in different
hosts communicate by
exchanging messages
(via application layer
protocol)
Csci 183/183W/232 Computer
Networks
Client process: process
that initiates
communication
Server process: process
that waits to be
contacted
• Note: applications with
P2P architectures have
client processes &
server processes
Network Applications
13
Application Programming Interface
API: application
programming interface
• defines interface
between application
and transport layer
• socket: Internet API
– two processes
communicate by sending
data into socket, reading
data out of socket
Q: how does a process
“identify” the other
process with which it
wants to communicate?
– IP address of host running
other process
– “port number” - allows
receiving host to
determine to which local
process the message
should be delivered
… lots more on this later.
Csci 183/183W/232 Computer
Networks
Network Applications
14
Sockets
• process sends/receives
messages to/from its
socket
• socket analogous to door
– sending process shoves
message out door
– sending process relies on
transport infrastructure on
other side of door which
brings message to socket at
receiving process
host or
server
host or
server
process
controlled by
app developer
process
socket
socket
TCP with
buffers,
variables
Internet
TCP with
buffers,
variables
controlled
by OS
• API: (1) choice of transport protocol; (2) ability to fix
a few parameters (lots more on this later)
Csci 183/183W/232 Computer
Networks
Network Applications
15
Addressing processes
• For a process to receive
messages, it must have an
identifier
• A host has a unique32-bit
IP address
• Q: does the IP address
of the host on which the
process runs suffice for
identifying the process?
• Answer: No, many
processes can be running
on same host
Csci 183/183W/232 Computer
Networks
• Identifier includes
both the IP address
and port numbers
associated with the
process on the host.
• Example port numbers:
– HTTP server: 80
– Mail server: 25
• More on this later
Network Applications
16
App-layer protocol defines
• Types of messages
exchanged, eg, request &
response messages
• Syntax of message types:
what fields in messages &
how fields are delineated
• Semantics of the fields, ie,
meaning of information in
fields
• Rules for when and how
processes send & respond
to messages
Csci 183/183W/232 Computer
Networks
Public-domain protocols:
• defined in RFCs
• allows for
interoperability
• eg, HTTP, SMTP
Proprietary protocols:
• eg, KaZaA
Network Applications
17
Building Networked Apps/Systems
Key Issues:
• Identify and locate service/data you or other want
–
•
•
•
Naming service/data, and locating host and app process providing
service/data
Decide on Application/System Structure
– Client-Server: host service/data on (“fixed”) servers
– Peer-to-Peer: service/data provided by (“on-off”) peers
– Hybrid?
Session Establishment
– Resolve names, bind app peer processes to addresses, establish
sessions, exchange messages based on application-layer transfer
protocols
Presentation and Processing of Messages
–
–
–
Sender: presentation and formatting of app data for transfer
Receiver: interpreting and re-presentation of app data received
……
Csci 183/183W/232 Computer
Networks
Network Applications
18
Application architectures
• Client-server
• Peer-to-peer (P2P)
• Hybrid of client-server and P2P
Csci 183/183W/232 Computer
Networks
Network Applications
19
Client-server archicture
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
Csci 183/183W/232 Computer
Networks
Network Applications
20
Pure P2P architecture
• no always on server
• arbitrary end systems
directly communicate
• peers are intermittently
connected and change IP
addresses
• example: Gnutella
Highly scalable
But difficult to manage
Csci 183/183W/232 Computer
Networks
Network Applications
21
Hybrid of client-server and P2P
Napster
– File transfer P2P
– File search centralized:
• Peers register content at central server
• Peers query same central server to locate content
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
Csci 183/183W/232 Computer
Networks
Network Applications
22
Example Application Protocols
• Domain Name Service
• Web
• Internet Mail
Csci 183/183W/232 Computer
Networks
Network Applications
23
DNS: Domain Name System
People: many identifiers:
– SSN, name, passport #
Internet hosts, routers:
– IP address (32 bit) - used
for addressing datagrams
– “name”, e.g., ww.yahoo.com
- used by humans
Q: map between IP
addresses and name ?
Csci 183/183W/232 Computer
Networks
Domain Name System:
• distributed database
implemented in hierarchy of
many name servers
• application-layer protocol host
and name servers to
communicate to resolve names
(address/name translation)
– note: core Internet function,
implemented as applicationlayer protocol
– complexity at network’s
“edge”
Network Applications
24
DNS
DNS services
• Hostname to IP
address translation
• Host aliasing
– Canonical and alias names
• Mail server aliasing
• Load distribution
– Replicated Web servers:
set of IP addresses for
one canonical name
Csci 183/183W/232 Computer
Networks
Why not centralize DNS?
• single point of failure
• traffic volume
• distant centralized
database
• maintenance
doesn’t scale!
Network Applications
25
Distributed, Hierarchical Database
Root DNS Servers
com DNS servers
yahoo.com
amazon.com
DNS servers DNS servers
org DNS servers
pbs.org
DNS servers
edu DNS servers
poly.edu
umass.edu
DNS serversDNS servers
Client wants IP for www.amazon.com; 1st approx:
• Client queries a root server to find com DNS
server
• Client queries com DNS server to get amazon.com
DNS server
• Client queries amazon.com DNS server to get IP
address for www.amazon.com
Csci 183/183W/232 Computer
Networks
Network Applications
26
DNS: Root name servers
• 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
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) Stockholm (plus 3
i Autonomica,
h ARL Aberdeen, MD
other locations)
j Verisign, ( 11 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
Csci 183/183W/232 Computer
Networks
Network Applications
27
TLD and Authoritative Servers
• Top-level domain (TLD) servers: responsible
for com, org, net, edu, etc, and all top-level
country domains uk, fr, ca, jp.
– Network solutions maintains servers for com TLD
– Educause for edu TLD
• Authoritative DNS servers: organization’s
DNS servers, providing authoritative
hostname to IP mappings for organization’s
servers (e.g., Web and mail).
– Can be maintained by organization or service provider
Csci 183/183W/232 Computer
Networks
Network Applications
28
Local Name Server
• Does not strictly belong to hierarchy
• Each ISP (residential ISP, company,
university) has one.
– Also called “default name server”
• When a host makes a DNS query, query is
sent to its local DNS server
– Acts as a proxy, forwards query into hierarchy.
Csci 183/183W/232 Computer
Networks
Network Applications
29
root DNS server
Example
2
• Host at cis.poly.edu
wants IP address for
gaia.cs.umass.edu
3
TLD DNS server
4
5
local DNS server
dns.poly.edu
1
8
requesting host
7
6
authoritative DNS server
dns.cs.umass.edu
cis.poly.edu
gaia.cs.umass.edu
Csci 183/183W/232 Computer
Networks
Network Applications
30
Recursive queries
root DNS server
recursive query:
• puts burden of name
resolution on
contacted name
server
• heavy load?
iterated query:
• contacted server
replies with name of
server to contact
• “I don’t know this
name, but ask this
server”
2
3
7
6
TLD DNS serve
local DNS server
dns.poly.edu
1
5
4
8
requesting host
authoritative DNS server
dns.cs.umass.edu
cis.poly.edu
gaia.cs.umass.edu
Csci 183/183W/232 Computer
Networks
Network Applications
31
DNS: caching and updating records
• once (any) name server learns mapping, it caches
mapping
– cache entries timeout (disappear) after some time
– TLD servers typically cached in local name servers
• Thus root name servers not often visited
• update/notify mechanisms under design by IETF
– RFC 2136
– http://www.ietf.org/html.charters/dnsind-charter.html
Csci 183/183W/232 Computer
Networks
Network Applications
32
DNS records
DNS: distributed db storing resource records (RR)
RR format: (name,
• Type=A
• Type=CNAME
– name is hostname
– value is IP address
• Type=NS
– name is alias name for some
“cannonical” (the real) name
www.ibm.com is really
servereast.backup2.ibm.com
– name is domain (e.g.
foo.com)
– value is domain name of
the host running a name
server for that domain
Csci 183/183W/232 Computer
Networks
value, type, class ttl)
– value is canonical name
• Type=MX
– value is name of mailserver
associated with name
Network Applications
33
Inserting records into DNS
• Example: just created startup “Network Utopia”
• Register name networkuptopia.com at a registrar
(e.g., Network Solutions)
– Need to provide registrar with names and IP addresses of your
authoritative name server (primary and secondary)
– Registrar inserts two RRs into the com TLD server:
(networkutopia.com, dns1.networkutopia.com, NS)
(dns1.networkutopia.com, 212.212.212.1, A)
• Put in authoritative server Type A record for
www.networkuptopia.com and Type MX record for
networkutopia.com
• How do people get the IP address of your Web site?
Csci 183/183W/232 Computer
Networks
Network Applications
34
Web and HTTP
First some jargon
• Web page consists of objects
• Object can be HTML file, JPEG image, Java
applet, audio 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
path name
host name
Csci 183/183W/232 Computer
Networks
Network Applications
35
HTTP overview
HTTP: hypertext
transfer protocol
PC running
Explorer
• Web’s application layer
protocol
• client/server model
– client: browser that
requests, receives,
“displays” Web objects
– server: Web server sends
objects in response to
requests
• HTTP 1.0: RFC 1945
• HTTP 1.1: RFC 2068
Csci 183/183W/232 Computer
Networks
Server
running
Apache Web
server
Mac running
Navigator
Network Applications
36
HTTP overview (continued)
Uses TCP:
HTTP is “stateless”
• client initiates TCP
connection (creates socket)
to server, port 80
• server accepts TCP
connection from client
• HTTP messages (applicationlayer protocol messages)
exchanged between browser
(HTTP client) and Web
server (HTTP server)
• TCP connection closed
• server maintains no
information about
past client requests
Csci 183/183W/232 Computer
Networks
aside
Protocols that maintain
“state” are complex!
• past history (state) must
be maintained
• if server/client crashes,
their views of “state” may
be inconsistent, must be
reconciled
Network Applications
37
HTTP connections
Nonpersistent HTTP
• At most one object is
sent over a TCP
connection.
• HTTP/1.0 uses
nonpersistent HTTP
Csci 183/183W/232 Computer
Networks
Persistent HTTP
• Multiple objects can
be sent over single
TCP connection
between client and
server.
• HTTP/1.1 uses
persistent connections
in default mode
Network Applications
38
Nonpersistent HTTP
(contains text,
Suppose user enters URL
references to 10
www.someSchool.edu/someDepartment/home.index
jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
(process) at
www.someSchool.edu on port 80
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection
socket. Message indicates
that client wants object
someDepartment/home.index
time
Csci 183/183W/232 Computer
Networks
1b. HTTP server at host
www.someSchool.edu waiting
for TCP connection at port 80.
“accepts” connection, notifying
client
3. HTTP server receives request
message, forms response
message containing requested
object, and sends message
into its socket
Network Applications
39
Nonpersistent HTTP (cont.)
4. HTTP server closes TCP
5. HTTP client receives response
connection.
message containing html file,
displays html. Parsing html
file, finds 10 referenced jpeg
objects
time
6. Steps 1-5 repeated for each
of 10 jpeg objects
Csci 183/183W/232 Computer
Networks
Network Applications
40
Response time modeling
Definition of RTT: time to
send a small packet to
travel from client to
initiate TCP
server and back.
connection
Response time:
RTT
request
• one RTT to initiate TCP
file
connection
RTT
• one RTT for HTTP
file
request and first few
received
bytes of HTTP response
to return
time
• file transmission time
total
= 2RTT+transmit time
Csci 183/183W/232 Computer
Network Applications
Networks
time to
transmit
file
time
41
Persistent HTTP
Nonpersistent HTTP issues:
• requires 2 RTTs per object
• OS must work and allocate
host resources for each TCP
connection
• but 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
are sent over connection
Csci 183/183W/232 Computer
Networks
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
• client sends requests as
soon as it encounters a
referenced object
• as little as one RTT for all
the referenced objects
Network Applications
42
An exmaple
• A HTML file references three very small
objects on the same server. Neglecting
transmission times, how much time elapses
with
–
–
–
–
–
–
Nonpersistent HTTP with no parallel TCP connections?
Nonpersistent HTTP with parallel connections?
Persistent HTTP with pipelining?
8RTT
4RTT
3RTT
Csci 183/183W/232 Computer
Networks
Network Applications
43
HTTP request message
• two types of HTTP messages: request, response
• HTTP request message:
– ASCII (human-readable format)
request line
(GET, POST,
HEAD commands)
GET /somedir/page.html HTTP/1.1
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
Csci 183/183W/232 Computer
Networks
Network Applications
44
HTTP request message: general format
Csci 183/183W/232 Computer
Networks
Network Applications
45
Uploading form input
Post method:
• Web page often
includes form input
• Input is uploaded to
server in entity body
URL method:
• Uses GET method
• Input is uploaded in
URL field of request
line:
www.somesite.com/animalsearch?monkeys&banana
Csci 183/183W/232 Computer
Networks
Network Applications
46
Method types
HTTP/1.1
• GET, POST, HEAD
• PUT
HTTP/1.0
• GET
• POST
• HEAD
– asks server to leave
requested object out of
response
Csci 183/183W/232 Computer
Networks
– uploads file in entity body
to path specified in URL
field
• DELETE
– deletes file specified in
the URL field
Network Applications
47
HTTP response message
status line
(protocol
status code
status phrase)
header
lines
data, e.g.,
requested
HTML file
Csci 183/183W/232 Computer
Networks
HTTP/1.1 200 OK
Connection close
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 ...
Network Applications
48
HTTP response status codes
In first line in server->client response message.
A few sample codes:
200 OK
– request succeeded, requested object later in this message
301 Moved Permanently
– requested object moved, new location specified later in this
message (Location:)
400 Bad Request
– request message not understood by server
404 Not Found
– requested document not found on this server
505 HTTP Version Not Supported
Csci 183/183W/232 Computer
Networks
Network Applications
49
User-server state: cookies
Many major Web sites
use cookies
Four components:
Example:
1) cookie header line in the
HTTP response message
2) cookie header line in
subsequent HTTP request
message
3) cookie file kept on user’s
host and managed by
user’s browser
4) back-end database at Web
site
Csci 183/183W/232 Computer
Networks
– Susan access Internet
always from same PC
– She visits a specific ecommerce site for first
time
– When initial HTTP
requests arrives at site,
site creates a unique ID
and creates an entry in
backend database for ID
Network Applications
50
Cookies: keeping “state” (cont.)
client
Cookie file
server
usual http request msg
usual http response +
Set-cookie: 1678
ebay: 8734
usual http request msg
Cookie file
amazon: 1678
ebay: 8734
cookie: 1678
usual http response msg
one week later:
Cookie file
amazon: 1678
ebay: 8734
usual http request msg
cookie: 1678
usual http response msg
Csci 183/183W/232 Computer
Networks
Network Applications
server
creates ID
1678 for user
cookiespecific
action
cookiespectific
action
51
Cookies (continued)
What cookies can bring:
• authorization
• shopping carts
• recommendations
• user session state
(Web e-mail)
Csci 183/183W/232 Computer
Networks
aside
Cookies and privacy:
• cookies permit sites to
learn a lot about you
• you may supply name
and e-mail to sites
• search engines use
redirection & cookies
to learn yet more
• advertising companies
obtain info across
sites
Network Applications
52
Web caches (proxy server)
Goal: satisfy client request without involving origin server
origin
server
• user sets browser: Web
accesses via cache
• browser sends all HTTP
requests to cache
client
Proxy
server
– object in cache: cache
returns object
– else cache requests object
from origin server, then
returns object to client
client
Csci 183/183W/232 Computer
Networks
Network Applications
origin
server
53
More about Web caching
• Cache acts as both client
and server
• Typically cache is installed
by ISP (university,
company, residential ISP)
Csci 183/183W/232 Computer
Networks
Why Web caching?
• 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)
Network Applications
54
Caching example
origin
Assumptions
servers
• average object size = 100,000 bits
• avg. request rate from institution’s
public
browsers to origin servers = 15/sec
Internet
• delay from Internet side router to any
origin server and back to router = 2
sec (Internet delay)
Consequences
1.5 Mbps
• utilization on LAN = 15%
access link
• utilization on access link = 100%
institutional
• total delay = Internet delay + access
network
10 Mbps LAN
delay + LAN delay
= 2 sec + minutes + milliseconds
Csci 183/183W/232 Computer
Networks
Network Applications
55
Caching example (cont)
Possible solution
• increase bandwidth of access
link to, say, 10 Mbps
Consequences
utilization on LAN = 15%
utilization on access link = 15%
Total delay = Internet delay +
access delay + LAN delay
= 2 sec + msecs + msecs
• often a costly upgrade
origin
servers
public
Internet
•
•
•
Csci 183/183W/232 Computer
Networks
10 Mbps
access link
institutional
network
Network Applications
10 Mbps LAN
56
Caching example (cont)
origin
servers
Install cache
• suppose hit rate is .4
public
Internet
Consequence
• 40% requests will be
satisfied almost immediately
• 60% requests satisfied by
origin server
• utilization of access link
reduced to 60%, resulting in
negligible delays (say 10
msec)
• total avg delay = Internet
delay + access delay + LAN
delay = .6*(2.01) secs +
milliseconds < 1.4 secs
Csci 183/183W/232 Computer
Networks
1.5 Mbps
access link
institutional
network
Network Applications
10 Mbps LAN
institutional
cache
57
Conditional GET
cache
• Goal: don’t send object if
cache has up-to-date cached
HTTP request msg
version
If-modified-since:
<date>
• cache: specify date of
cached copy in HTTP request
If-modified-since: <date>
• server: response contains no
object if cached copy is upto-date:
HTTP/1.0 304 Not Modified
HTTP response
server
object
not
modified
HTTP/1.0
304 Not Modified
HTTP request msg
If-modified-since:
<date>
HTTP response
object
modified
HTTP/1.0 200 OK
<data>
Csci 183/183W/232 Computer
Networks
Network Applications
58
Trying out http (client side) for yourself
1. Telnet to your favorite Web server:
telnet www.seas.gwu.edu 80 Opens TCP connection to port 80
(default http server port) at www.seas.gwu.edu.
Anything typed in sent
to port 80 at www.seas.gwu.edu
2. Type in a GET http request:
GET /~cheng/index.html HTTP/1.0
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 http server!
Csci 183/183W/232 Computer
Networks
Network Applications
59
Web and HTTP Summary
Transaction-oriented (request/reply), use TCP, port 80
Client
Server
GET /index.html HTTP/1.0
Csci 183/183W/232 Computer
Networks
HTTP/1.0
200 Document follows
Content-type: text/html
Content-length: 2090
-- blank line -HTML text of the Web page
Network Applications
60
Electronic Mail
outgoing
message queue
user mailbox
Three major components:
• user agents
• mail servers
• simple mail transfer
protocol: smtp
user
agent
mail
server
user
agent
SMTP
User Agent
SMTP
• a.k.a. “mail reader”
• composing, editing, reading
mail
mail messages
server
• e.g., Eudora, Outlook, pine,
Netscape Messenger
• outgoing, incoming messages
stored on server
user
SMTP
mail
server
user
agent
user
agent
user
agent
agent
Csci 183/183W/232 Computer
Networks
Network Applications
61
Electronic Mail: mail servers
user
agent
Mail Servers
• mailbox contains incoming
messages (yet to be read)
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
mail
server
user
agent
SMTP
SMTP
SMTP
mail
server
mail
server
user
agent
user
agent
user
agent
user
agent
Csci 183/183W/232 Computer
Networks
Network Applications
62
Electronic Mail:SMTP [RFC 821]
• uses tcp to reliably transfer email msg from client to
server, port 25
• direct transfer: sending server to receiving server
• three phases of transfer
– handshaking (greeting)
– transfer of messages
– closure
• command/response interaction
– commands: ASCII text
– response: status code and phrase
• messages must be in 7-bit ASCII
Csci 183/183W/232 Computer
Networks
Network Applications
63
Sample SMTP Interaction
S:
C:
S:
C:
S:
C:
S:
C:
S:
C:
C:
C:
S:
C:
S:
220 hamburger.edu
HELO crepes.fr
250 Hello crepes.fr, pleased to meet you
MAIL FROM: <[email protected]>
250 [email protected]... Sender ok
RCPT TO: <[email protected]>
250 [email protected] ... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Do you like ketchup?
How about pickles?
.
250 Message accepted for delivery
QUIT
221 hamburger.edu closing connection
Csci 183/183W/232 Computer
Networks
Network Applications
64
Try SMTP interaction yourself
• 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)
Csci 183/183W/232 Computer
Networks
Network Applications
65
SMTP: Final Words
• smtp uses persistent
connections
• smtp requires that
message (header & body)
be in 7-bit ascii
• certain character strings
are not permitted in
message (e.g., CRLF.CRLF).
Thus message has to be
encoded (usually into either
base-64 or quoted
printable)
• smtp server uses
CRLF.CRLF to determine
end of message
Csci 183/183W/232 Computer
Networks
Comparison with http
• http: pull
• email: push
• both have ASCII
command/response
interaction, status codes
• http: each object is
encapsulated in its own
response message
• smtp: multiple object
message sent in a multipart
message
Network Applications
66
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 commands!
header
blank
line
body
• body
– the “message”, ASCII
characters only
Csci 183/183W/232 Computer
Networks
Network Applications
67
Message Format: Multimedia Extensions
• MIME: multimedia mail extension, RFC 2045, 2056
• additional lines in msg header declare MIME content
type
MIME version
method used
to encode data
multimedia data
type, subtype,
parameter declaration
From: [email protected]
To: [email protected]
Subject: Picture of yummy crepe.
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
base64 encoded data .....
.........................
......base64 encoded data
encoded data
Csci 183/183W/232 Computer
Networks
Network Applications
68
MIME Types
Content-Type: type/subtype; parameters
Text
• example subtypes: plain,
html. Eg: text/plain, or
text/richtext
Image
• example subtypes: jpeg,
gif (image/jpeg)
Audio
• example subtypes: basic
(8-bit mu-law encoded),
32kadpcm (32 kbps
coding)
Csci 183/183W/232 Computer
Networks
Video
• example subtypes: mpeg,
quicktime
Application
• other data that must be
processed by reader
before “viewable”
• example subtypes:
msword, octet-stream
(application/postscri
pt,
application/msword)
Network Applications
69
Multipart Type
From: [email protected]
To: [email protected]
Subject: Picture of yummy crepe.
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=98766789
--98766789
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain
Dear Bob,
Please find a picture of a crepe.
--98766789
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
base64 encoded data .....
.........................
......base64 encoded data
--98766789--
Csci 183/183W/232 Computer
Networks
Network Applications
70
Mail Access Protocols
SMTP
SMTP
user
agent
sender’s mail
server
•
•
POP3 or
IMAP
user
agent
receiver’s mail
server
SMTP: delivery/storage to receiver’s server
Mail access protocol: retrieval from server
– POP: Post Office Protocol [RFC 1939]
• authorization (agent <-->server) and download
– IMAP: Internet Mail Access Protocol [RFC 1730]
• more features (more complex)
• manipulation of stored msgs on server
– HTTP: Hotmail , Yahoo! Mail, etc.
Csci 183/183W/232 Computer
Networks
Network Applications
71
Email Summary
Alice
Message
user agent
(MUA)
client
Message
transfer
agent
(MTA)
SMTP
outgoing mail queue
SMTP
over TCP
(RFC 821)
Bob
POP3 (RFC 1225)/ IMAP (RFC 1064)
for accessing mail
Message
user agent
(MUA)
user mailbox
Csci 183/183W/232 Computer
Networks
Network Applications
port 25
server
Message
transfer
agent
(MTA)
72
Summary
• Application Service Requirements:
–
reliability, bandwidth, delay
• Client-server vs. Peer-to-Peer Paradigm
– DHT techniques
• Application Protocols and Their Implementation:
–
–
–
–
specific formats: header, data;
control vs. data messages
stateful vs. stateless
centralized vs. decentralized
• Specific Protocols:
–
–
–
–
–
HTTP
SMTP, POP3
DNS
SIP/SDP
……
Csci 183/183W/232 Computer
Networks
Network Applications
73