ccn2001 Slides2 6pp
ccn2001 Slides2 6pp
Overview
actions taken
“Top-down” approach means we will first learn the – user services provided
application layer and then learn about lower layers by lower layer protocols
Rensselaer Polytechnic Institute 3 Rensselaer Polytechnic Institute 4
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
1
Application-layer protocols
Client-server paradigm
API: application Q: how does a process
Typical network app has two application “identify” the other
pieces: client and server
transport
network
programming process with which it
data link
physical interface wants to communicate?
Server: request • defines interface – IP address of host
• provides requested between application running other process
service to client, via and transport layer – “port number” -
replies • socket: Internet API allows receiving host
reply to determine to which
• e.g., Web server application
– two processes local process the
sends requested Web transport
network
communicate by message should be
data link sending data into delivered
page, mail server physical
socket, reading data
delivers e-mail out of socket
What Transport Service does an App need? Transport service requirements of common
apps
Data loss Timing
• some apps (e.g., audio) • some apps (e.g., Application Data loss Bandwidth Time Sensitive
can tolerate some loss Internet telephony,
• other apps (e.g., file interactive games) file transfer no loss elastic no
transfer, telnet) require require low delay to e-mail no loss elastic no
100% reliable data be “effective” Web documents loss-tolerant elastic no
transfer real-time audio/video loss-tolerant audio: 5Kb-1Mb yes, 100’s msec
video:10Kb-5Mb
Bandwidth stored audio/video loss-tolerant same as above yes, few secs
• some apps (e.g., multimedia) require minimum interactive games loss-tolerant few Kbps up yes, 100’s msec
financial apps no loss elastic yes and no
amount of bandwidth to be “effective”
• other apps (“elastic apps”) make use of
whatever bandwidth they get
Services provided by Internet transport Internet apps: their protocols and transport
protocols protocols
TCP service:
UDP service:
• connection-oriented: setup Application Underlying
• unreliable data
required between client, transfer between Application layer protocol transport protocol
server
sending and
• reliable transport between e-mail smtp [RFC 821] TCP
receiving process remote terminal access telnet [RFC 854] TCP
sending and receiving • does not provide: Web http [RFC 2068] TCP
process
connection setup, file transfer ftp [RFC 959] TCP
• flow control: sender won’t reliability, flow streaming multimedia proprietary TCP or UDP
overwhelm receiver control, congestion (e.g. RealNetworks)
• congestion control: control, timing, or remote file server NSF TCP or UDP
throttle sender when bandwidth guarantee Internet telephony proprietary typically UDP
network overloaded (e.g., Vocaltec)
2
The Web: the http protocol The http protocol: more
http: hypertext http is “stateless”
http: TCP transport service:
transfer protocol • server maintains
• client initiates TCP
• Web’s application no information
htt
pr
connection (creates
layer protocol equ socket) to server, port 80 about past client
PC running ht est
• client/server model tp requests
Explorer res
pon • server accepts TCP aside
se
– client: browser that connection from client Protocols that maintain
requests, receives, • http messages “state” are complex!
“displays” Web est
equ Server (application-layer
pr ons
e • past history (state) must
objects htt esp running protocol messages)
ttpr Apache Web be maintained
– server: Web server h
server
exchanged between
sends objects in browser (http client) and • if server/client crashes,
response to Mac running Web server (http server) their views of “state”
requests Navigator • TCP connection closed may be inconsistent,
• http1.0: RFC 1945 must be reconciled
• http1.1: RFC 2068 Rensselaer Polytechnic Institute 13 Rensselaer Polytechnic Institute 14
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
3
http request message: general format http message format: response
status line
(protocol
status code HTTP/1.0 200 OK
status phrase) Date: Thu, 06 Aug 1998 12:00:15 GMT
Server: Apache/1.3.0 (Unix)
Last-Modified: Mon, 22 Jun 1998 …...
header
Content-Length: 6821
lines
Content-Type: text/html
http response status codes Trying out http (client side) for
In first line in server->client response message. yourself
A few sample codes: 1. Telnet to your favorite Web server:
200 OK Opens TCP connection to port 80
– request succeeded, requested object later in telnet www.eurecom.fr 80 (default http server port) at www.eurecom.fr.
this message Anything typed in sent
to port 80 at www.eurecom.fr
301 Moved Permanently
– requested object moved, new location specified 2. Type in a GET http request:
later in this message (Location:)
400 Bad Request GET /~ross/index.html HTTP/1.0 By typing this in (hit carriage
return twice), you send
– request message not understood by server this minimal (but complete)
GET request to http server
404 Not Found
– requested document not found on this server 3. Look at response message sent by http
505 HTTP Version Not Supported server!
Rensselaer Polytechnic Institute 21 Rensselaer Polytechnic Institute 22
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
4
User-server interaction: conditional Web Caches (proxy server)
GET
• Goal: don’t send Goal: satisfy client request without involving origin server
object if client has up- client server • user sets browser:
to-date stored Web accesses via web
(cached) version http request msg cache origin
If-modified-since: object server
• client: specify date of <date>
not • client sends all http
requests to web cache htt
Proxy
cached copy in http http response modified pr server est
equ equ
request client http est pr nse
HTTP/1.0 – if object at web
304 Not Modified res htt e spo
If-modified-since: cache, web cache pon pr
se htt
est
<date> immediately returns htt
equ pr
• server: response object in http pr nse equ
http request msg htt espo htt
pr
est
contains no object if response p r esp
tt ons
object
If-modified-since:
h e
cached copy up-to- <date> – else requests object
modified client
date: http response from origin server, origin
HTTP/1.0 304 Not HTTP/1.1 200 OK
then returns http server
Modified …
<data> response to client
Rensselaer Polytechnic Institute 25 Rensselaer Polytechnic Institute 26
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
– link out of
institutional/local
institutional
ISP network often cache Web Server
bottleneck
Rensselaer Polytechnic Institute 27 Rensselaer Polytechnic Institute 28
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
Browsers
Routers
Replicated
content
Content Sink
Router
Content Source
Web Server
Rensselaer Polytechnic Institute Web Servers 29 Rensselaer Polytechnic Institute 30
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
5
CDN: Architectural Layout ftp: the file transfer protocol
4 Request
Routing(RR) FTP file transfer
FTP FTP
1 user client server
interface
Client
5 user
Distribution 2 at host local file remote file
Origin system system
6
System
3
Surrogate
• transfer file to/from remote host
• client/server model
q Publisher informs RR of Content Availability. – client: side that initiates transfer
q Content Pushed to Distribution System. (either to/from remote)
q Client Requests Content, Requested redirected to RR. – server: remote host
q RR finds the most suitable Surrogate • ftp: RFC 959
q Surrogate services client request. • ftp server: port 21
Rensselaer Polytechnic Institute 31 Rensselaer Polytechnic Institute 32
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
6
Electronic Mail: smtp [RFC 821] Sample smtp interaction
• uses tcp to reliably transfer email msg
from client to server, port 25 S: 220 hamburger.edu
C: HELO crepes.fr
• direct transfer: sending server to S: 250 Hello crepes.fr, pleased to meet you
receiving server C: MAIL FROM: <[email protected]>
S: 250 [email protected]... Sender ok
• three phases of transfer C: RCPT TO: <[email protected]>
– handshaking (greeting) S: 250 [email protected] ... Recipient ok
C: DATA
– transfer of messages S: 354 Enter mail, end with "." on a line by itself
– closure C: Do you like ketchup?
C: How about pickles?
• command/response interaction C: .
– commands: ASCII text S: 250 Message accepted for delivery
C: QUIT
– response: status code and phrase S: 221 hamburger.edu closing connection
• messages must be in 7-bit ASCII
Rensselaer Polytechnic Institute 37 Rensselaer Polytechnic Institute 38
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
7
MIME types Multipart Type
From: [email protected]
Content-Type: type/subtype; parameters To: [email protected]
Subject: Picture of yummy crepe.
Text MIME-Version: 1.0
• example subtypes: Video Content-Type: multipart/mixed; boundary=98766789
plain, html • example subtypes: --98766789
mpeg, quicktime Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain
Image
• example subtypes: Application Dear Bob,
jpeg, gif • other data that must Please find a picture of a crepe.
be processed by --98766789
Content-Transfer-Encoding: base64
reader before
Audio Content-Type: image/jpeg
“viewable”
• exampe subtypes:
• example subtypes: base64 encoded data .....
basic (8-bit mu-law .........................
msword, octet-
encoded), 32kadpcm ......base64 encoded data
stream
(32 kbps coding) Rensselaer Polytechnic Institute 43 --98766789-- Rensselaer Polytechnic Institute 44
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
8
DNS: Root name servers Simple DNS example
root name server
host surf.eurecom.fr
• contacted by local wants IP address of
name server that can gaia.cs.umass.edu
not resolve name 2 4
1. Contacts its local DNS 3
• root name server: 5
server,
– contacts dns.eurecom.fr
authoritative name 2. dns.eurecom.fr
server if name contacts root name local name server authorititive name server
mapping not server, if necessary dns.eurecom.fr dns.umass.edu
known
3. root name server 1 6
– gets mapping contacts authoritative
– returns mapping to name server,
local name server dns.umass.edu, if
requesting host
• ~ dozen root name necessary surf.eurecom.fr
gaia.cs.umass.edu
servers worldwide
Rensselaer Polytechnic Institute 49 Rensselaer Polytechnic Institute 50
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
9
DNS protocol, messages DNS protocol, messages
DNS protocol : query and reply messages,
both with same message format Name, type fields
for a query
msg header
• identification: 16 bit # RRs in reponse
for query, repy to to query
query uses same # records for
• flags: authoritative servers
– query or reply
additional “helpful”
– recursion desired info that may be used
– recursion available
– reply is
authoritative Rensselaer Polytechnic Institute 55 Rensselaer Polytechnic Institute 56
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
contact
outToServer
10
Client/server socket interaction: TCP UDP Sockets
UDP: no “connection”
Server (running on hostid) Client between client and
create socket, server
port=x, for
incoming request: • no handshaking
welcomeSocket =
ServerSocket() • sender explicitly
TCP attaches IP address application viewpoint
wait for incoming create socket,
connection request connection setup connect to hostid, port=x and port of UDP provides unreliable transfer
clientSocket =
connectionSocket =
welcomeSocket.accept()
Socket() destination of groups of bytes (“datagrams”)
• server must extract IP between client and server
send request using
read request from clientSocket address, port of
connectionSocket
sender from received
write reply to datagram
connectionSocket read reply from
clientSocket UDP: transmitted data
close
connectionSocket close may be received out
clientSocket
of order, or lost
Rensselaer Polytechnic Institute 61 Rensselaer Polytechnic Institute 62
Shivkumar Kalvanaraman, Biplab Sikdar Shivkumar Kalvanaraman, Biplab Sikdar
11