Title: Goals:
1Application Layer
- Goals
- conceptual implementation aspects of network
application protocols - client-server paradigm
- peer-to-peer (p2p) paradigm
- learn about protocols by examining popular
application-level protocols - HTTP, FTP, SMTP, POP, DNS
2Applications 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, p2p file share, the
Web - Application-layer protocols
- define messages exchanged by apps and actions
taken - uses services provided by lower layer protocols
3Client-server paradigm
- Typical network app has two pieces client and
server - Client
- initiates contact with server
- typically requests service from server (e.g.,
request WWW page, send email) - Server
- provides requested service to client
- e.g., sends requested WWW page, receives/stores
received email
4Transport service requirements of apps
- Data Delivery
- some apps (e.g., audio, video) 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 - other apps (elastic apps) make use of whatever
bandwidth they can get - Timing
- some apps (e.g., Internet telephony, interactive
games) require low delay to be effective
5Transport service requirements of common apps
Time Sensitive no no no yes, 100s msec yes,
few secs yes, 100s msec yes and no
Application file transfer e-mail Web
documents real-time audio/video stored
audio/video interactive games financial apps
Data loss no loss no loss no loss loss-tolerant
loss-tolerant loss-tolerant no loss
Bandwidth elastic elastic elastic audio
5Kb-1Mb video10Kb-5Mb same as above few Kbps
up elastic
6Services provided by Internet transport protocols
- UDP service
- unreliable data transfer between sending and
receiving process - does not provide connection setup, reliability,
flow control, congestion control, timing, or
bandwidth guarantee
- TCP service
- connection-oriented setup required between
client, server - 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 bandwidth
guarantees
7Internet apps application transport protocols
Application layer protocol SMTP RFC 821 Telnet
RFC 854 HTTP RFC 2068 FTP RFC
959 proprietary (e.g. Windows Media) NFS propriet
ary (e.g., Vocaltec)
Underlying transport protocol TCP TCP TCP TCP TCP
or UDP TCP or UDP typically UDP
Application e-mail remote terminal access Web
file transfer streaming multimedia remote file
server Internet telephony
8WWW the HTTP protocol
- HTTP HyperText Transfer Protocol
- WWWs application layer protocol
- client/server model
- client browser that requests, receives,
displays WWW objects - server WWW server sends objects in response to
requests - HTTP/1.0 RFC 1945
- HTTP/1.1 RFC 2068
9HTTP
- http is stateless
- server maintains no information about past client
requests
- TCP transport service
- client initiates a TCP connection to server, port
80 - server accepts TCP connection from client
- http messages (application-layer protocol
messages) exchanged between browser and WWW
server - TCP connection closed
10HTTP example
- Suppose user enters URL www.someUniv.ac.kr/someDep
artment/index.html
(contains text, references to 10 jpeg images)
- 1a. HTTP client initiates TCP connection to HTTP
server (process) at www.someUniv.ac.kr. Port 80
is default for HTTP server.
1b. HTTP server at host www.someUniv.ac.kr
waiting for TCP connection at port 80. accepts
connection, notifying client
2. HTTP client sends HTTP request message
(containing URL) into TCP connection socket
3. HTTP server receives request message, forms
response message containing requested object
(someDepartment/index.html), sends message into
socket
11HTTP example (cont.)
4. HTTP server closes TCP connection.
- 5. HTTP client receives response message
containing HTML file, displays HTML. Parsing
HTML file, finds 10 referenced jpeg objects
6. Steps 1-5 repeated for each of 10 jpeg objects
time
- non-persistent connection one object in each TCP
connection - some browsers create multiple TCP connections
simultaneously - one per object (HTTP/1.0) - persistent connection multiple objects
transferred within one TCP connection (HTTP/1.1)
12HTTP message format Request
- two types of HTTP messages request, response
- HTTP request message
- ASCII (human-readable format)
13HTTP request message general format
14HTTP message format Reply
status line (protocol status code status phrase)
HTTP/1.1 200 OK Connection close Date Fri, 12
May 2000 123000 GMT Server Apache/1.3.0
(Unix) Last-Modified Mon, 22 Jun 1998 ...
Content-Length 6821 Content-Type text/html
data goes here ...
header lines
data, e.g., requested html file
15HTTP reply status codes
- In the first line of response message. 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
- 304 Not Modified
- requested document has not been modified
(Conditional GET) - 505 HTTP Version Not Supported
16User-server interaction conditional GET
- Goal dont send object if client has up-to-date
stored (cached) version - client specify date of cached copy in HTTP
request - If-modified-since ltdategt
- server response contains no object if cached
copy up-to-date - HTTP/1.0 304 Not Modified
17User-server interaction Authentication
- Goal control access to server documents
- stateless client must present authorization in
each request - authorization typically name, password
- authorization header line in request
- if no authorization presented, server refuses
access, sends - WWW authenticate
- header line in response
18User-server interaction Cookies
- Cookies is a way of remembering things for you
(e.g., authentication, user preferences, previous
choices) - server sends cookie to client in response
- Set-cookie
- client present cookie in later requests
- cookie
- server matches presented-cookie with
server-stored cookies
19Web Caching
Goal satisfy client request without involving
origin server
- user sets browser WWW accesses via web cache
- client sends all HTTP requests to web cache
- if object at web cache, web cache immediately
returns object in HTTP response - else requests the object from origin server,
saves it in the cache, then returns object in
HTTP response
20Why Web Caching?
- Assume cache is close to client (e.g., in the
same network) - faster response time cache closer to client
- decrease traffic to distant servers
- link out of enterprise network often bottleneck
- Cache server farm could be deployed to distribute
load thus to increase performance
21FTP the file transfer protocol
- transfer file to/from remote host
- client/server model
- client side that initiates transfer (either
to/from remote) - server remote host
- FTP RFC 959
- FTP server port 21
22FTP separate control, data connections
- FTP client contacts FTP server at port 21,
specifying TCP as transport protocol - two parallel TCP connections opened
- control exchange commands, responses between
client, server. - out of band control
- data file data to/from server using port 20
- ftp server maintains state current directory,
earlier authentication
23Active Mode vs. Passive Mode FTP
client
FTP Server
client
FTP Server
connect
connect
21
21
2834
2834
accept
accept
passive mode request
active mode 2835
passive mode 3848
connect
connect
20
3848
2835
2835
data transfer
data transfer
20
3848
2835
2835
disconnect
disconnect
21
21
2834
2834
accept
accept
Passive Mode
Active Mode
- Passive Mode FTP
- when client is located inside a firewall.
- Use dynamically generated port number instead of
20 - Cannot detect the FTP data transfer by the packet
header only - Visit http//slacksite.com/other/ftp.html for
detailed explanation
24Analysis of Passive FTP traffic
- Use the same mechanism as the multimedia traffic
analysis - Examination of FTP control packet payload
- The payload data from a FTP server to a FTP
client
IP, TCP Header
FTP Payload
227 Entering Passive Mode (141,223,82,141,128,40)
- The IP address of the FTP server
- 141.223.82.141
- The port number of the FTP server for data
transfer - 128 256 40 32808
25Electronic Mail
- Three major components
- user agents
- mail servers
- simple mail transfer protocol (SMTP) is used
between mail servers - User Agent
- a.k.a. mail reader
- composing, editing, reading mail messages
- e.g., Outlook, elm, mutt
- also uses SMTP between agent and server
26Electronic Mail mail servers
- Mail Servers
- mailbox contains incoming messages (yet to be
read) for users - 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
27Electronic 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
- closure
- command/response interaction
- commands ASCII text
- response status code and phrase
28Mail message format
- RFC 822 standard for text message format
- header lines
- To
- From
- Subject
- body
- the message, ASCII characters only
- line containing only .
header
blank line
body
.
29Message format multimedia extensions
- MIME Multipurpose Internet Mail Extension, RFC
2045, 2056 - MIME content type declared in msg header
30MIME types
- Video
- example subtypes mpeg, quicktime
- Application
- other data that must be processed by reader
before viewable - example subtypes msword, octet-stream
- Text
- example subtypes plain, html
- Image
- example subtypes jpeg, gif
- Audio
- example subtypes basic (8-bit mu-law encoded),
32kadpcm (32 kbps coding)
31Mail access protocols
- SMTP delivery/storage to receivers server
- Mail Access Protocol retrieval from server
- POP Post Office Protocol RFC 1939
- authorization (agent lt--gtserver) and download
- IMAP Internet Mail Access Protocol RFC 1730
- more features (more complex)
- manipulation of stored msgs on server
32POP3 protocol
- authorization phase
- client commands
- user username
- pass password
- server responses
- OK
- -ERR
- transaction phase, client
- list list message numbers
- retr retrieve message by number
- dele delete
- quit
33IMAP
- More functionalities than POP
- users can manipulate messages on server, e.g., to
create hierarchy of folders - folders organization accessed from all users
machines (office, _at_home, mobile) - users can retrieve only part(s) of a multipart
message, e.g., downloading in a small portable
terminal only header or text part of a multimedia
message. - More complex
- server maintains state, e.g., hierarchy of
folders for each user
34Web Mail
- Convenient for the user on the go (Internet Café,
WebTV, ) - User can organize their hierarchy of folders on
servers - May be slow
- server typically far from client
- interaction with server through CGI scripts
35DNS Domain Name System
- Domain Name System
- distributed database implemented in hierarchy of
many name servers - application-layer protocol
- host, routers, name servers to communicate
to resolve names (address/name translation) - note core Internet function implemented as
application-layer protocol - complexity at networks edge
- People
- many identifiers SSN, name, Passport
- Internet hosts, routers
- IP address (32 bit) - used for addressing
datagrams - name, e.g., www.postech.ac.kr - used by humans
- Q map between IP addresses and name ?
36DNS name servers
- no server has all name-to-IP address mappings
- local name servers
- each ISP, company has local (default) name server
- host DNS query first goes to local name server
- authoritative name server
- for a host stores that hosts IP address, name
- can perform name/address translation for that
hosts name
- Why not centralize DNS?
- single point of failure
- traffic volume
- distant centralized database
- maintenance
- Just doesnt scale!
37DNS 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
- 13 root name servers worldwide
38Simple DNS example
- host surf.eurecom.fr wants IP address of
gaia.cs.umass.edu - 1. Contacts its local DNS server, dns.eurecom.fr
- 2. dns.eurecom.fr contacts root name server, if
necessary - 3. root name server contacts authoritative name
server, dns.umass.edu, if necessary
39DNS example
root name server
- Root name server
- may not know authoritative name server
- may know intermediate name server who to contact
to find authoritative name server
6
2
3
7
5
4
1
8
authoritative name server dns.cs.umass.edu
requesting host surf.eurecom.fr
gaia.cs.umass.edu
40DNS iterated queries
- 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 dont know this name, but ask this server
41DNS caching and updating records
- once (any) name server learns mapping, it caches
mapping - cache entries timeout (disappear) after some time
- DNS Related RFCs - http//www.zoneedit.com/doc/rfc
/
42DNS records
- DNS distributed db storing resource records (RR)
- TypeCNAME
- name is an alias name for some cannonical (the
real) name - value is cannonical name
- TypeA
- name is hostname
- value is IP address
- TypeNS
- name is domain (e.g. foo.com)
- value is IP address of authoritative name server
for this domain
- TypeMX
- value is hostname of mailserver associated with
name
43DNS protocol, messages
- DNS protocol query and repy messages, both with
the same message format
- msg header
- identification 16 bit for query, repy to query
uses same - flags
- query or reply
- recursion desired
- recursion available
- reply is authoritative
44DNS protocol, messages
Name, type fields for a query
RRs in reponse to query
records for authoritative servers
additional helpful info that may be used
45Peer-to-peer (P2P) paradigm
- Peer has the functionality of both client and
server
46Why peer-to-peer (P2P)?
- The information creation, distribution and
consummation are ideally a decentralized and
distributed process - The relationship between consumer and producer of
information normally is peer to peer - Popular P2P applications
- Instant Messaging MSN/Yahoo Messengers, ICQ,
etc. - File Sharing WinMX, Kazaa, Morpheus, e-donkey,
V-share, BitTorrent, etc. - P2P apps use proprietary, Freenet, Gnutella,
FastTrack, BitTorrent protocols
47P2P Profit Model
Many businesses are attempting to utilize P2P for
commercial purposes
48Summary
- Learned the conceptual implementation aspects
of network application protocols - client-server paradigm
- peer-to-peer (p2p) paradigm
- Learned about protocols by examining popular
application-level protocols - HTTP, FTP, SMTP, POP, DNS