0% found this document useful (0 votes)
6 views

Application Layer Fall24

Uploaded by

deniz12erkan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Application Layer Fall24

Uploaded by

deniz12erkan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 115

Chapter 2: Application Layer

Our goals:  learn about protocols


 conceptual, by examining popular
implementation application-level
aspects of network protocols
application protocols o HTTP
o transport-layer o FTP
service models o SMTP / POP3 / IMAP
o DNS
o client-server
paradigm  programming network
o peer-to-peer
applications
o socket API
paradigm

2: Application Layer 1
Some network apps
 E-mail  Internet telephone
 Web  Real-time video
 Instant messaging conference
 Remote login  Massive parallel
 P2P file sharing computing
 Multi-user network
games
 Streaming stored
video clips

2: Application Layer 2
Creating a network app
Write programs that application
transport

run on different end


network
o data link

systems and
physical

o communicate over a
network.
o e.g., Web: Web server
software communicates
with browser software
No software written for application
application

devices in network core


transport
transport network
network data link
Network core devices do
data link physical
o physical

not function at app layer


o This design allows for
rapid app development
2: Application Layer 3
Application architectures
 Client-server
 Peer-to-peer (P2P)
 Hybrid of client-server and P2P

2: Application Layer 4
Client-server archicture
server:
o always-on host
o permanent IP address
o server farms for scaling
clients:
o communicate with
server
o may be intermittently
connected
o may have dynamic IP
addresses
o do not communicate
directly with each other

2: Application Layer 5
Pure P2P architecture
 no always-on server
 arbitrary end systems
directly communicate
 peers request service from
other peers, provide service in
return to other peers
o self scalability – new peers
bring new service capacity,
as well as new service
demands
 peers are intermittently
connected and change IP
addresses
o complex management
2: Application Layer 6
Hybrid of client-server and P2P
Skype
o voice-over-IP P2P application
o centralized server: finding address of remote
party:
o client-client connection: direct (not through
server)
Instant messaging
o Chatting between two users is P2P
o 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
friends
2: Application Layer 7
Network applications: some jargon

Process: program running user agent: interfaces


within a host. with user “above” and
 within same host, two network “below”.
processes communicate  implements user
using interprocess interface &
communication (defined application-level
by OS). protocol
 processes running in o Web: browser
different hosts o E-mail: mail reader
communicate with an o streaming audio/video:
application-layer media player
protocol
2: Application Layer 8
Applications and application-layer protocols

Application: communicating, application


transport
distributed processes network
data link
o e.g., e-mail, Web, P2P file physical

sharing, instant messaging


o running in end systems
(hosts)
o exchange messages to
implement application
Application-layer protocols
o one “piece” of an app application
application
transport
transport
o define messages network
network
data link
exchanged by apps and data link
physical
physical

actions taken
o use communication services
provided by lower layer
protocols (TCP, UDP)
2: Application Layer 9
App-layer protocol defines
 Types of messages Public-domain protocols:
exchanged, eg, request  defined in RFCs
& response messages
 allows for
 Syntax of message
interoperability
types: what fields in
messages & how fields  eg, HTTP, SMTP
are delineated Proprietary protocols:
 Semantics of the  eg, KaZaA, Skype
fields, ie, meaning of
information in fields
 Rules for when and
how processes send &
respond to messages

2: Application Layer 10
Processes communicating across network
host or host or
 process sends/receives server server
messages to/from its
socket controlled by
app developer
 socket analogous to door process process

o sending process shoves socket socket


message out door TCP with TCP with
buffers, Internet buffers,
o sending process asssumes variables variables
transport infrastructure
on other side of door which
controlled
brings message to socket by OS
at receiving process

2: Application Layer 11
Addressing processes:
 For a process to  Identifier includes
receive messages, it both the IP address
must have an identifier and port numbers
 Every host has a unique associated with the
32-bit IP address process on the host.
 Q: does the IP address  Example port numbers:
of the host on which o HTTP server: 80
the process runs o Mail server: 25
suffice for identifying
the process?
 Answer: No, many
processes can be
running on same host
2: Application Layer 12
What transport service does an app need?
Data loss Throughput
 some apps (e.g., audio) can  some apps (e.g.,
tolerate some loss multimedia) require
 other apps (e.g., file minimum amount of
transfer, telnet) require bandwidth to be
100% reliable data
“effective”
transfer
 other apps (“elastic
Delay apps”) make use of
 some apps (e.g.,
whatever bandwidth
Internet telephony, they get
interactive games)
require low delay to be
“effective”
2: Application Layer 13
Transport service requirements of common apps

Application Data loss Throughput Time Sensitive

file transfer no loss elastic no


e-mail no loss elastic no
Web documents no loss elastic no
real-time audio/video loss-tolerant audio: 5kbps-1Mbps yes, 100’s msec
video:10kbps-5Mbps
stored audio/video loss-tolerant same as above yes, few secs
interactive games loss-tolerant few kbps up yes, 100’s msec
instant messaging no loss elastic yes and no

2: Application Layer 14
Internet transport protocols services

TCP service: UDP service:


 connection-oriented: setup  unreliable data transfer
required between client and between sending and
server processes receiving process
 reliable transport between  does not provide:
sending and receiving process connection setup,
 flow control: sender won’t reliability, flow control,
overwhelm receiver congestion control, timing,
or bandwidth guarantee
 congestion control: throttle
sender when network
overloaded Q: why bother? Why is
 does not providing: timing, there a UDP?
minimum bandwidth
guarantees
2: Application Layer 15
Internet apps: application, transport protocols

Application Underlying
Application layer protocol transport protocol

e-mail SMTP [RFC 2821] TCP


remote terminal access Telnet [RFC 854] TCP
Web HTTP [RFC 2616] TCP
file transfer FTP [RFC 959] TCP
streaming multimedia HTTP (e.g., YouTube), TCP or UDP
RTP [RFC 1889]
Internet telephony SIP, RTP, proprietary
(e.g., Skype) typically UDP

2: Application Layer 16
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.cs.bilkent.edu.tr/bilkent/academic/main_logo.gif

host name path name

2: Application Layer 17
HTTP overview

HTTP: hypertext
transfer protocol
 Web’s application layer PC running
protocol Explorer

 client/server model
o client: browser that
requests, receives, Server
“displays” Web objects running
Apache Web
o server: Web server
server
sends objects in
response to requests
Mac running
 HTTP 1.0: RFC 1945 Navigator
 HTTP 1.1: RFC 2068

2: Application Layer 18
HTTP overview (continued)
Uses TCP: HTTP is “stateless”
 client initiates TCP  server maintains no
connection (creates socket) information about
to server, port 80 past client requests
 server accepts TCP Protocols that maintain
connection from client “state” are complex!
 HTTP messages (application-  past history (state) must
layer protocol messages) be maintained
exchanged between browser  if server/client crashes,
(HTTP client) and Web their views of “state” may
server (HTTP server) be inconsistent, must be
 TCP connection closed reconciled

2: Application Layer 19
HTTP connections
Nonpersistent HTTP Persistent HTTP
 At most one object is  Multiple objects can
sent over a TCP be sent over single
connection. TCP connection
 HTTP/1.0 uses between client and
nonpersistent HTTP server.
 HTTP/1.1 uses
persistent connections
in default mode

2: Application Layer 20
Nonpersistent HTTP
(contains text,
Suppose user enters URL references to 10
www.bilkent.edu.tr/someDepartment/ jpeg images)

1a. HTTP client initiates TCP


connection to HTTP server
1b. HTTP server at host
(process) at www.bilkent.edu.tr
www.bilkent.edu.tr waiting for
on port 80
TCP connection at port 80.
“accepts” connection, notifying
client
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection 3. HTTP server receives request
socket. Message indicates message, forms response
that client wants object message containing requested
someDepartment/ object, and sends message
into its socket

time
2: Application Layer 21
Nonpersistent HTTP (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
time 6. Steps 1-5 repeated for each
of 10 jpeg objects

2: Application Layer 22
Response time modeling
Definition of RRT: time to
send a small packet to
travel from client to
server and back. initiate TCP
connection
Response time: RTT
 one RTT to initiate TCP request
connection file
time to
RTT
 one RTT for HTTP
transmit
file
request and first few file
received
bytes of HTTP response
to return time time
 file transmission time

total = 2RTT+transmit time


2: Application Layer 23
Persistent HTTP

Nonpersistent HTTP issues: Persistent without pipelining:


 requires 2 RTTs per object  client issues new request

 OS must work and allocate only when previous


host resources for each TCP response has been received
connection  one RTT for each

 but browsers often open referenced object


parallel TCP connections to Persistent with pipelining:
fetch referenced objects  default in HTTP/1.1
Persistent HTTP  client sends requests as
 server leaves connection soon as it encounters a
open after sending response referenced object
 subsequent HTTP messages  as little as one RTT for all
between same client/server the referenced objects
are sent over connection

2: Application Layer 24
HTTP request message

 two types of HTTP messages: request, response


 HTTP request message:
o ASCII (human-readable format)

request line
(GET, POST, GET /somedir/page.html HTTP/1.1
HEAD commands) Host: www.bilkent.edu.tr
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
2: Application Layer 25
HTTP request message: general format

2: Application Layer 26
Method types
HTTP/1.0 HTTP/1.1
 GET  GET, POST, HEAD

 POST  PUT

 HEAD o uploads file in entity


body to path specified
o asks server to leave
in URL field
requested object out of
response  DELETE
o deletes file specified in
the URL field

2: Application Layer 27
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

2: Application Layer 28
HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection close
Date: Thu, 06 Aug 1998 12:00:15 GMT
Server: Apache/1.3.0 (Unix)
header
Last-Modified: Mon, 22 Jun 1998 …...
lines
Content-Length: 6821
Content-Type: text/html

data, e.g., data data data data data ...


requested
HTML file

2: Application Layer 29
HTTP response status codes
In first line in server->client response message.
A few sample codes:
200 OK
o request succeeded, requested object later in this message
301 Moved Permanently
o requested object moved, new location specified later in
this message (Location:)
400 Bad Request
o request message not understood by server
404 Not Found
o requested document not found on this server
505 HTTP Version Not Supported
2: Application Layer 30
Trying out HTTP (client side) for yourself

1. Telnet to your favorite Web server:


telnet www.ee.bilkent.edu.tr 80 Opens TCP connection to port 80
(default HTTP server port) at
www.ee.bilkent.edu.tr.
Anything typed in sent
to port 80 at www.ee.bilkent.edu.tr
2. Type in a GET HTTP request:
GET /~ezhan/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!

2: Application Layer 31
User-server interaction: authorization
Authorization : control access to server
server content
client
 authorization credentials: usual http request msg
typically name, password 401: authorization req.
 stateless: client must present WWW authenticate:
authorization in each request
o authorization: header line in usual http request msg
each request + Authorization: <cred>
o if no authorization: header, usual http response msg
server refuses access,
sends
WWW authenticate: usual http request msg
+ Authorization: <cred>
header line in response
usual http response msg time

2: Application Layer 32
Cookies: keeping “state”
Many major Web sites Example:
use cookies o Susan access Internet
Four components: always from same PC
o She visits a specific e-
1) cookie header line in
commerce site for first
the HTTP response
time
message
o When initial HTTP
2) cookie header line in
requests arrives at site,
HTTP request message
site creates a unique ID
3) cookie file kept on and creates an entry in
user’s host and managed backend database for
by user’s browser ID
4) back-end database at
Web site

2: Application Layer 33
Cookies: keeping “state” (cont.)

client server
Cookie file usual http request msg server
usual http response + creates ID
ebay: 8734 Set-cookie: 1678 1678 for user

Cookie file
usual http request msg
amazon: 1678 cookie: 1678 cookie-
ebay: 8734 specific
usual http response msg action
one week later:
usual http request msg
Cookie file cookie-
cookie: 1678
amazon: 1678 spectific
ebay: 8734 usual http response msg action

2: Application Layer 34
Cookies (continued)
What cookies can bring: Cookies and privacy:
 authorization  cookies permit sites to

 shopping carts
learn a lot about you
 you may supply name
 recommendations
and e-mail to sites
 user session state
 search engines use
(Web e-mail)
redirection & cookies
how to keep “state”: to learn yet more
 protocol endpoints:
 advertising companies
maintain state at
obtain info across
sender/receiver over
multiple transactions sites
 cookies: http messages
carry state 2: Application Layer 35
Set-Cookie HTTP Response
Header
Set-Cookie: NAME=VALUE; expires=DATE; path=PATH;
domain=DOMAIN_NAME; secure
o NAME=VALUE
• sequence of characters excluding semi-colon, comma and
white space (the only required field)
o expires=DATE
Format: Wdy, DD-Mon-YYYY HH:MM:SS GMT
o domain=DOMAIN_NAME
• Browser performs “tail matching” searching through cookies
file
• Default domain is the host name of the server which
generated the cookie response
o path=PATH
• the subset of URLs in a domain for which the cookie is valid
o Secure: if secure cookie will only be transmitted if the
communications channel with the host is secure, e.g.,
HTTPS
2: Application Layer 36
Cookies File
 Netscape keeps all cookies in a single file
~username/.netscape/cookies whereas IE keeps each cookie in
separate files in the folder C:\Documents and Settings\user\Cookies
# Netscape HTTP Cookie File
# http://www.netscape.com/newsref/std/cookie_spec.html
# This is a generated file! Do not edit.

.netscape.com TRUE / FALSE 1128258721 sampler 1097500321


.edge.ru4.com TRUE / FALSE 2074142135 ru4.uid 2|3|0#12740302632086421#1917818738
.edge.ru4.com TRUE / FALSE 1133246135 ru4.1188.gts :2
.netscape.com TRUE / FALSE 1128065747 RWHAT set|1128065747300
.nytimes.com TRUE / FALSE 1159598159 RMID 833ff0b33a03433cdccf603e
.netscape.com TRUE / FALSE 1128148560 adsNetPopup0 1128062159725
servedby.advertising.com TRUE / FALSE 1130654161 1812261973 _433cdcd1,,695214^76559_
.advertising.com TRUE / FALSE 1285742161 ACID bb640011280621610000!
.bluestreak.com TRUE / FALSE 1443407766 id 33167285258566120 bb=141A11twQw_"4totrKoAA| adv=
.mediaplex.com TRUE / FALSE 1245628800 svid 80016269101
.nytdigital.com TRUE / FALSE 1625726176 TID 0e0pcsb11jpn70
.nytdigital.com TRUE / FALSE 1625726176 TData
.nytimes.com TRUE / FALSE 1625726176 TID 0e0pcsb11jpn70
.nytimes.com TRUE / FALSE 1625726176 TData
.doubleclick.net TRUE / FALSE 1222670215 id 8000006195fbc8b
servedby.advertising.com TRUE / FALSE 1130654216 5907528 _433cdd08,,707769^243007_
www.yahoo.com TRUE / FALSE 1149188401 FPB fc1hmqbqc11jpnci
2: Application Layer 37
Cookies File Format
Domain Accessible Path Secure Expiration Name Value
by all (Unix time)
hosts
edge.ru4.com TRUE / FALSE 2074142135 ru4.uid 2|3|0#1274…

nytimes.com TRUE / FALSE 1625726176 TID 0e0pcsb11jpn70

Sun, 23 Sep 2035 06:35:35 UTC Thu, 8 Jul 2021 06:36:16 UTC

2: Application Layer 38
Conditional GET: client-side caching

 Goal: don’t send object if client server


client has up-to-date cached HTTP request msg
version If-modified-since:
object
 client: specify date of <date>
not
cached copy in HTTP request modified
HTTP response
If-modified-since:
HTTP/1.0
<date> 304 Not Modified
 server: response contains no
object if cached copy is up-
HTTP request msg
to-date: If-modified-since:
HTTP/1.0 304 Not <date> object
Modified modified
HTTP response
HTTP/1.0 200 OK
<data>
2: Application Layer 39
FTP: the file transfer protocol

FTP file transfer


FTP FTP
user client server
interface
user
at host local file remote file
system system

 transfer file to/from remote host


 client/server model
o client: side that initiates transfer (either to/from
remote)
o server: remote host
 ftp: RFC 959
 ftp server: port 21
2: Application Layer 40
FTP: separate control, data connections
TCP control connection
 FTP client contacts FTP port 21
server at port 21, specifying
TCP as transport protocol
TCP data connection
 Client obtains authorization FTP port 20 FTP
over control connection client server
 Client browses remote
directory by sending  Server opens a second TCP
commands over control data connection to transfer
connection. another file.
 When server receives a  Control connection: “out of
command for a file transfer, band”
the server opens a TCP data  FTP server maintains “state”:
connection to client current directory, earlier
 After transferring one file, authentication
server closes connection.
2: Application Layer 41
FTP commands, responses

Sample commands: Sample return codes


 sent as ASCII text over  status code and phrase (as
control channel in HTTP)
 USER username  331 Username OK,
 PASS password password required
 125 data connection
 LIST return list of file in
already open;
current directory
transfer starting
 RETR filename retrieves  425 Can’t open data
(gets) file connection
 STOR filename stores  452 Error writing
(puts) file onto remote file
host

2: Application Layer 42
Electronic Mail outgoing
message queue
user mailbox
user
Three major components: agent
 user agents mail
user
server
 mail servers agent
 simple mail transfer SMTP mail
protocol: SMTP server user
SMTP agent
User Agent
 a.k.a. “mail reader” SMTP
mail user
 composing, editing, reading agent
server
mail messages
 e.g., Eudora, Outlook, elm, user
Netscape Messenger agent
user
 outgoing, incoming messages agent
stored on server
2: Application Layer 43
Electronic Mail: mail servers
user
Mail Servers agent
 mailbox contains incoming mail
user
messages for user server
agent
message queue of outgoing

SMTP
(to be sent) mail messages mail
server user
 SMTP protocol between mail
servers to send email SMTP agent

messages SMTP
o client: sending mail mail user
agent
server server
o “server”: receiving mail
user
server agent
user
agent

2: Application Layer 44
Electronic Mail: SMTP [RFC 2821]

 uses TCP to reliably transfer email message from client


to server, port 25
 direct transfer: sending server to receiving server
 three phases of transfer
o handshaking (greeting)
o transfer of messages
o closure
 command/response interaction
o commands: ASCII text
o response: status code and phrase

 messages must be in 7-bit ASCII

2: Application Layer 45
Scenario: Ayşe sends message to Ali
1) Ayşe uses UA to compose 4) SMTP client sends Ayşe’s
message and “to” message over the TCP
[email protected] connection
2) Ayşe’s UA sends message 5) Ali’s mail server places the
to her mail server; message message in Ali’s mailbox
placed in message queue 6) Ali invokes his user agent
3) Client side of SMTP opens to read message
TCP connection with Ali’s
mail server

Ayşe Ali
1 mail
mail
server user
user server
2 agent
agent 3 6
4 5

2: Application Layer 46
SMTP interaction for yourself
 telnet cs.bilkent.edu.tr 25
220 gordion.cs.bilkent.edu.tr ESMTP Sendmail 8.12.9/8.12.9;
Wed, 3 Mar 2004 11:17:52 +0200 (EET)
 HELO cs.bilkent.edu.tr
250 gordion.cs.bilkent.edu.tr Hello nemrut.ee.bilkent.edu.
tr [139.179.12.28], pleased to meet you
 MAIL FROM: <[email protected]>
250 2.1.0 <[email protected]>... Sender ok
 RCPT TO: <[email protected]>
250 2.1.5 <[email protected]>... Recipient ok
 DATA
354 Enter mail, end with "." on a line by itself
 hello
.
250 2.0.0 Message accepted for delivery
 QUIT
221 2.0.0 gordion.cs.bilkent.edu.tr closing connection
2: Application Layer 47
SMTP: final words
 SMTP uses persistent Comparison with HTTP:
connections
 HTTP: pull
 SMTP requires message
(header & body) to be in 7-  SMTP: push
bit ASCII  both have ASCII
 SMTP server uses command/response
CRLF.CRLF to determine interaction, status codes
end of message
 HTTP: each object
encapsulated in its own
response msg
 SMTP: multiple objects
sent in multipart msg

2: Application Layer 48
Mail access protocols
SMTP SMTP access user
user
agent protocol agent

sender’s mail receiver’s mail


server server

 SMTP: delivery/storage to receiver’s server


 Mail access protocol: retrieval from server
o POP: Post Office Protocol [RFC 1939]
• authorization (agent <-->server) and download
o IMAP: Internet Mail Access Protocol [RFC 1730]
• more features (more complex)
• manipulation of stored msgs on server
o HTTP: Hotmail , Yahoo! Mail, etc.

2: Application Layer 49
DNS: Domain Name System

People: many identifiers: Domain Name System:


o SSN, name, passport #  distributed database
Internet hosts, routers: implemented in hierarchy of
many name servers
o IP address (32 bit) -
 application-layer protocol
used for addressing
host, routers, name servers to
datagrams
communicate to resolve names
o “name”, e.g., (address/name translation)
www.cs.bilkent.edu.tr -
o note: core Internet
used by humans
function, implemented as
Q: map between IP application-layer protocol
addresses and name ? o complexity at network’s
“edge”

2: Application Layer 50
DNS
DNS services Why not centralize DNS?
 Hostname to IP  single point of failure

address translation  traffic volume

 Host aliasing  distant centralized


o Canonical and alias database
names  maintenance
 Mail server aliasing
 Load distribution doesn’t scale!
o Replicated Web
servers: set of IP
addresses for one
canonical name

2: Application Layer 51
Distributed, Hierarchical Database
Root DNS Servers

com DNS servers org DNS servers edu DNS servers

pbs.org poly.edu umass.edu


yahoo.com amazon.com
DNS servers DNS serversDNS servers
DNS servers DNS 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
2: Application Layer 52
DNS: Root name servers
 contacted by local name server that can not resolve name
 root name server:
o contacts authoritative name server if name mapping not known
o gets mapping
o 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
j Verisign, ( 11 locations) other 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

2: Application Layer 53
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.
o Network solutions maintains servers for com TLD
o 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).
o Can be maintained by organization or service
provider

2: Application Layer 54
Local Name Server
 Does not strictly belong to hierarchy
 Each ISP (residential ISP, company,
university) has one.
o Also called “default name server”
 When a host makes a DNS query, query is
sent to its local DNS server
o Acts as a proxy, forwards query into hierarchy.

2: Application Layer 55
Example root DNS server

2
 Host at 3
TLD DNS server
firat.bilkent.edu.tr 4
wants IP address for
5
gaia.cs.umass.edu
local DNS server
dns.bilkent.edu.tr
7 6
1 8

authoritative DNS server


dns.cs.umass.edu
requesting host
Firat.bilkent.edu.tr

gaia.cs.umass.edu

2: Application Layer 56
Recursive queries root DNS server

recursive query:
2 3
 puts burden of name
resolution on 7 6
contacted name TLD DNS serve
server
 heavy load?
local DNS server
4
iterated query: dns.bilkent.edu.tr 5

 contacted server 1 8
replies with name of
server to contact authoritative DNS server
 “I don’t know this dns.cs.umass.edu
requesting host
name, but ask this Firat.bilkent.edu.tr
server”
gaia.cs.umass.edu

2: Application Layer 57
DNS: caching and updating records
 once (any) name server learns mapping, it caches
mapping
o cache entries timeout (disappear) after some
time
o TLD servers typically cached in local name
servers
• Thus root name servers not often visited
 update/notify mechanisms under design by IETF
o RFC 2136
o http://www.ietf.org/html.charters/dnsind-charter.html

2: Application Layer 58
DNS records
DNS: distributed db storing resource records (RR)
RR format: (name, value, type, ttl)

 Type=A  Type=CNAME
o name is hostname o name is alias name for some
o value is IP address “cannonical” (the real) name
 Type=NS www.ibm.com is really
o name is domain (e.g. servereast.backup2.ibm.com
foo.com) o value is cannonical name
o value is IP address of
authoritative name server  Type=MX
for this domain
o value is name of mailserver
associated with name

2: Application Layer 59
DNS protocol, messages
DNS protocol : query and reply messages, both with same
message format

msg header
 identification: 16 bit #
for query, reply to query
uses same #
 flags:
o query or reply
o recursion desired
o recursion available
o reply is authoritative

2: Application Layer 60
DNS protocol, messages

Name, type fields


for a query

RRs in reponse
to query

records for
authoritative servers

additional “helpful”
info that may be used

2: Application Layer 61
Inserting records into DNS
 Example: just created startup “Network Utopia”
 Register name networkuptopia.com at a registrar
(e.g., Network Solutions)
o Need to provide registrar with names and IP addresses of
your authoritative name server (primary and secondary)
o 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.networkutopia.com and Type MX record for
mail.networkutopia.com

2: Application Layer 62
How do people connect to Web server?
com TLD DNS
server
contains type A
and NS RRs for 3: reply contains IP
Network Utopia address for auth.
name server for
2
Network Utopia
(212.212.212.1) authoritative name
local DNS server 4 server for Network
dns.bilkent.edu.tr Utopia
5: reply contains IP IP: 212.212.212.1
address for Web
1 6
server for
Network Utopia
(212.212.212.178) Web server for
Network Utopia
requesting host 7: TCP connection IP: 212.212.212.178
firat.bilkent.edu.tr
2: Application Layer 63
Socket programming
Goal: learn how to build client/server application that
communicate using sockets

Socket API socket


 introduced in BSD4.1 UNIX, a host-local,
1981 application-created,
 explicitly created, used, OS-controlled interface
released by apps (a “door”) into which
 client/server paradigm application process can
 two types of transport both send and
service via socket API: receive messages to/from
another application
o unreliable datagram
process
o reliable, byte stream-
oriented

2: Application Layer 64
Socket-programming using TCP
Socket: a door between application process and end-
end-transport protocol (UCP or TCP)
TCP service: reliable transfer of bytes from one
process to another

controlled by
controlled by process application
application process
developer
developer socket socket
TCP with TCP with controlled by
controlled by
buffers, operating
operating buffers, internet system
system variables variables

host or host or
server server

2: Application Layer 65
Socket programming with TCP
Client must contact server  When contacted by client,
 server process must first server TCP creates new
be running socket for server process to
 server must have created communicate with client
socket (door) that o allows server to talk with
welcomes client’s contact multiple clients
o source port numbers
Client contacts server by:
used to distinguish
 creating client-local TCP
clients (more in Chap 3)
socket
 specifying IP address, port
application viewpoint
number of server process
TCP provides reliable, in-order
 When client creates
transfer of bytes (“pipe”)
socket: client TCP between client and server
establishes connection to
server TCP
2: Application Layer 66
Stream jargon
 A stream is a sequence of
characters that flow into
or out of a process.
 An input stream is
attached to some input
source for the process, eg,
keyboard or socket.
 An output stream is
attached to an output
source, eg, monitor or
socket.

2: Application Layer 67
Socket programming with TCP
keyboard monitor
Example client-server app:
1) client reads line from
standard input (inFromUser

inFromUser
input
stream
stream) , sends to server via Client
socket (outToServer Process
process
stream)
2) server reads line from socket
3) server converts line to
uppercase, sends back to

inFromServer
outToServer
output input
client stream stream

4) client reads, prints modified


line from socket client TCP
clientSocket

(inFromServer stream) socket TCP


socket

to network from network

2: Application Layer 68
Client/server socket interaction: TCP
Server (running on hostid) Client
create socket,
port=x, for
incoming request:
welcomeSocket =
ServerSocket()

TCP create socket,


wait for incoming
connection request connection setup connect to hostid, port=x
connectionSocket = clientSocket =
welcomeSocket.accept() Socket()

send request using


read request from clientSocket
connectionSocket

write reply to
connectionSocket read reply from
clientSocket
close
connectionSocket close
clientSocket
2: Application Layer 69
Example: Java client (TCP)
import java.io.*;
import java.net.*;
class TCPClient {

public static void main(String argv[]) throws Exception


{
String sentence;
String modifiedSentence;
Create
input stream BufferedReader inFromUser =
new BufferedReader(new InputStreamReader(System.in));
Create
client socket, Socket clientSocket = new Socket("hostname", 6789);
connect to server
Create DataOutputStream outToServer =
output stream new DataOutputStream(clientSocket.getOutputStream());
attached to socket
2: Application Layer 70
Example: Java client (TCP), cont.

Create BufferedReader inFromServer =


input stream new BufferedReader(new
attached to socket InputStreamReader(clientSocket.getInputStream()));

sentence = inFromUser.readLine();
Send line
to server outToServer.writeBytes(sentence + '\n');

Read line modifiedSentence = inFromServer.readLine();


from server
System.out.println("FROM SERVER: " + modifiedSentence);

clientSocket.close();

}
}
2: Application Layer 71
Example: Java server (TCP)
import java.io.*;
import java.net.*;

class TCPServer {

public static void main(String argv[]) throws Exception


{
String clientSentence;
Create String capitalizedSentence;
welcoming socket
ServerSocket welcomeSocket = new ServerSocket(6789);
at port 6789
while(true) {
Wait, on welcoming
socket for contact Socket connectionSocket = welcomeSocket.accept();
by client
BufferedReader inFromClient =
Create input new BufferedReader(new
stream, attached InputStreamReader(connectionSocket.getInputStream()));
to socket

2: Application Layer 72
Example: Java server (TCP), cont

Create output
stream, attached DataOutputStream outToClient =
to socket new DataOutputStream(connectionSocket.getOutputStream());
Read in line
from socket clientSentence = inFromClient.readLine();

capitalizedSentence = clientSentence.toUpperCase() + '\n';


Write out line
outToClient.writeBytes(capitalizedSentence);
to socket
}
}
} End of while loop,
loop back and wait for
another client connection

2: Application Layer 73
Socket programming with UDP

UDP: no “connection” between


client and server
 no handshaking

 sender explicitly attaches application viewpoint


IP address and port of
destination to each packet UDP provides unreliable transfer
of groups of bytes (“datagrams”)
 server must extract IP
between client and server
address, port of sender
from received packet
UDP: transmitted data may be
received out of order, or
lost

2: Application Layer 74
Client/server socket interaction: UDP
Server (running on hostid) Client

create socket, create socket,


port=x, for clientSocket =
incoming request: DatagramSocket()
serverSocket =
DatagramSocket()
Create, address (hostid, port=x,
send datagram request
using clientSocket
read request from
serverSocket

write reply to
serverSocket
specifying client read reply from
host address, clientSocket
port number close
clientSocket

2: Application Layer 75
Example: Java client (UDP)
keyboard monitor

inFromUser
input
stream

Client
Process
Input: receives
process
packet (TCP
Output: sends received “byte
packet (TCP sent stream”)

receivePacket
sendPacket
“byte stream”) UDP UDP
packet packet

client UDP
clientSocket
socket UDP
socket

to network from network

2: Application Layer 76
Example: Java client (UDP)
import java.io.*;
import java.net.*;

class UDPClient {
public static void main(String args[]) throws Exception
{
Create
input stream BufferedReader inFromUser =
new BufferedReader(new InputStreamReader(System.in));
Create
client socket DatagramSocket clientSocket = new DatagramSocket();
Translate
InetAddress IPAddress = InetAddress.getByName("hostname");
hostname to IP
address using DNS byte[] sendData = new byte[1024];
byte[] receiveData = new byte[1024];

String sentence = inFromUser.readLine();


sendData = sentence.getBytes();
2: Application Layer 77
Example: Java client (UDP), cont.
Create datagram
with data-to-send, DatagramPacket sendPacket =
length, IP addr, port new DatagramPacket(sendData, sendData.length, IPAddress, 9876);

Send datagram clientSocket.send(sendPacket);


to server
DatagramPacket receivePacket =
new DatagramPacket(receiveData, receiveData.length);
Read datagram
clientSocket.receive(receivePacket);
from server
String modifiedSentence =
new String(receivePacket.getData());

System.out.println("FROM SERVER:" + modifiedSentence);


clientSocket.close();
}
}

2: Application Layer 78
Example: Java server (UDP)
import java.io.*;
import java.net.*;

class UDPServer {
public static void main(String args[]) throws Exception
Create {
datagram socket
DatagramSocket serverSocket = new DatagramSocket(9876);
at port 9876
byte[] receiveData = new byte[1024];
byte[] sendData = new byte[1024];

while(true)
{
Create space for
DatagramPacket receivePacket =
received datagram
new DatagramPacket(receiveData, receiveData.length);
Receive serverSocket.receive(receivePacket);
datagram
2: Application Layer 79
Example: Java server (UDP), cont
String sentence = new String(receivePacket.getData());
Get IP addr
InetAddress IPAddress = receivePacket.getAddress();
port #, of
sender int port = receivePacket.getPort();

String capitalizedSentence = sentence.toUpperCase();

sendData = capitalizedSentence.getBytes();
Create datagram
DatagramPacket sendPacket =
to send to client new DatagramPacket(sendData, sendData.length, IPAddress,
port);
Write out
datagram serverSocket.send(sendPacket);
to socket }
}
} End of while loop,
loop back and wait for
another datagram
2: Application Layer 80
Socket programming: references
Java-tutorials:
 “All About Sockets” (Sun tutorial),
http://www.javaworld.com/javaworld/jw-12-
1996/jw-12-sockets.html
 “Socket Programming in Java: a tutorial,”
http://www.javaworld.com/javaworld/jw-12-
1996/jw-12-sockets.html

2: Application Layer 81
Web caches (proxy server) Dere
Goal: satisfy client request without involving origin server


user sets browser: Web
accesses via cache
browser sends all HTTP
requests to cache
o object in cache: cache
returns object
client
esmer! Proxy
server
origin
server
Yor

Fore
o else cache requests
object from origin
server, then returns
object to client
Advantages -s!gn!f!cant client
smaller delay operatoresraft or!g!nal
server -

cl!ck
counts origin
cl!ent -

or!g!nalserver
yakınproxyodateredes !sa cl!ent
>
d!sad/money
-

extra l!ne
daha of
server neaders
header
entrol

sag
n + +p
II not
-cashable"
the
under 2: Application Layer 82
not
server
More about Web caching
 Cache acts as both client Why Web caching?
and server  Reduce response time for
 Cache can do up-to-date client request.
check using If-modified-
 Reduce traffic on an
since HTTP header
institution’s access link.
o Issue: should cache take
risk and deliver cached
 Internet dense with caches
object without checking? enables “poor” content
o Heuristics are used.
providers to effectively
deliver content
 Typically cache is installed
by ISP (university,
company, residential ISP)

2: Application Layer 83
Caching example (1)
origin
Assumptions
servers
 average object size = 100,000
bits public
Internet
 avg. request rate from
institution’s browser to origin
serves = 15/sec
1.5 Mbps
 delay from institutional router
access link
to any origin server and back
institutional
to router = 2 sec
network
10 Mbps LAN
Consequences
 utilization on LAN = 15%
 utilization on access link = 100%

 total delay = Internet delay + institutional


access delay + LAN delay cache
= 2 sec + minutes + milliseconds
2: Application Layer 84
Caching example (2)
origin
Possible solution
servers
 increase bandwidth of access
link to, say, 10 Mbps public
Internet
Consequences
 utilization on LAN = 15%
 utilization on access link = 15%
10 Mbps
 Total delay = Internet delay +
access link
access delay + LAN delay
institutional
= 2 sec + msecs + msecs
network
 often a costly upgrade
10 Mbps LAN

institutional
cache

2: Application Layer 85
Caching example (3)
origin
servers
Install cache
 suppose hit rate is .4 public
Internet
Consequence
 40% requests will be
satisfied almost immediately
1.5 Mbps
 60% requests satisfied by access link
origin server institutional
 utilization of access link network
10 Mbps LAN
reduced to 60%, resulting in
negligible delays (say 10
msec)
institutional
cache

2: Application Layer 86
reduce the
delay >use closer serverarayaround ana
-

World control them

problem
Content distribution networks (CDNs)
shar!ng
server
Customer ( origin server =
connectedin North America
The content providers are

the CDN customers. to te
Late
econom!cally

to P more
Content replication when ect advantages
dec!des
o

 CDN company installs


an

!t
CDN distribution node
hundreds of CDN servers
throughout Internet
o in lower-tier ISPs, close
to users
 CDN replicates its customers’
content in CDN servers.
When provider updates CDN server
CDN server
content, CDN updates in S. America CDN server
in Asia
servers in Europe e
bu
Fa
m!rroredthe
f!ls 2: Application Layer 87
how does th!s work !

CDN example
HTTP request for
ects
www.foo.com/sports/sports.html

> dec!des
wh!chob !ntent
1 Origin server served
tr!but!on all
-

be
w!ll d!s o
In oseet

&BRAINcl!ent E
2 DNS query for www.cdn.com
the whe wants
CDNs authoritative what
!t

3 DNS server +
-
>

algor!th - HP)
HTTP request for >send response
www.cdn.com/www.foo.com/sports/ruth.gif
IP'ys close to

göndermeay I cl!ent!st daha


Nearby hep aynı server
CDN server
origin server ↓
CDN company hang
send the
n!ch ?
 www.foo.com h+ +
p request  cdn.com load
less
 distributes HTML  distributes gif files

 Replaces:  uses its authoritative

!nd
http://www.foo.com/sports.ruth.gif DNS server to route
with redirect requests
http://www.cdn.com/www.foo.com/sports/ruth.gif
!p address 2: Application Layer 88
!ts
Streaming stored video

simple scenario:

Internet

video server client


(stored video)

real!ty
!n

Application Layer 2-
89
↓ ADAPTIVE E download problem ->
lower/charge
request !n
Streaming multimedia: DASH

h+ + p for
lower Bu
URL


se!ner
DASH: Dynamic, Adaptive Streaming over HTTP trate
h!g
ceh!gh encoded
!n

 server: BU +

URL

Demet
o divides video file into multiple chunks
o each chunk stored, encoded at different rates
Cordoad
·

o manifest file: provides URLs for different chunks


e
 client: +http to
ede
o periodically measures server-to-client bandwidth
o consulting manifest, requests one chunk at a time
• chooses maximum coding rate sustainable given current
bandwidth
flex!ble
• can choose different coding rates at different points in time
(depending on available bandwidth at time)

Application Layer 2-
90
Streaming multimedia: DASH
from closest cl!ent
problem : serve

 DASH: Dynamic, Adaptive Streaming over


HTTP
 “intelligence” at client: client determines
o when to request chunk (so that buffer
starvation, or overflow does not occur)
o what encoding rate to request (higher quality
when more bandwidth available)
o where to request chunk (can request from URL
server that is “close” to client or has high
available bandwidth)

Application Layer 2-
91
Content distribution networks
 challenge: how to stream content (selected
from millions of videos) to hundreds of
thousands of simultaneous users?
-

Tay
Nagosoption 1: single, large “mega-server”

-
o single point of failure
o point of network congestion
o long path to distant clients
multiple copies of video sent over outgoing link

-
o

….quite simply: this solution doesn’t scale


Application Layer 2-
92
Content distribution networks
 challenge: how to stream content (selected
from millions of videos) to hundreds of
thousands of simultaneous users?
option 2: store/serve multiple copies of

ustros

videos at multiple geographically
distributed sites (CDN)
enter deep: push CDN servers deep into many
o
access networks 100 e

• close to users
• used by Akamai, 1700 locations
o bring home: smaller number (10’s) of larger
clusters in POPs near (but not within) access
networks
• used by Limelight Application Layer 2-
93
Content Distribution Networks (CDNs)
 CDN: stores copies of content at CDN nodes
• e.g. Netflix stores copies of MadMen
 subscriber requests content from CDN
• directed to nearby copy, retrieves content
• may choose different copy if network path
congested

where’s Madmen?

Application Layer 2-
94
Content Distribution Networks (CDNs)

Challenges: coping with a congested


Internet
o from which CDN node to retrieve content?
o viewer behavior in presence of congestion?
o what content to place in which CDN node?
Case study: Netflix

Amazon cloud upload copies of


multiple versions of
video to CDN servers
CDN
server
Netflix registration,
accounting servers
3. Manifest file
2. Bob browses returned for
CDN
Netflix video 2 requested video server
3
1

1. Bob manages
Netflix account CDN
server

4. DASH
streaming

Application Layer 2-
96
Pure P2P architecture
morspectno

 no always-on server the

 arbitrary end systems


directly communicate peer-peer
 peers are intermittently
connected and change IP
addresses

examples:
o file distribution
(BitTorrent)
o Streaming (KanKan)
o
O
VoIP (Skype)
2: Application Layer 97
File Distribution: Server-Client vs P2P
Question : How much time to distribute file
from one server to N peers?
us: server upload
bandwidth
Server
ui: peer i upload
u1 d1 u2 bandwidth
us d2
di: peer i download
File, size F bandwidth
dN
Network (with
uN abundant bandwidth)

2: Application Layer 98
File distribution time: server-client
Server
 server sequentially F u1 d1 u2
sends N copies: us d2

o NF/us time dN Network (with


abundant bandwidth)
 client i takes F/di uN
time to download

Time to distribute F
to N clients using = dcs = max { NF/us, F/min(di) }
i
client/server approach
increases linearly in N
(for large N) 2: Application Layer 99
File distribution time: P2P
Server
 server must send one F u1 d1 u2
copy: F/us time us d2

 client i takes F/di time Network (with


dN
to download abundant bandwidth)
uN
 NF bits must be
downloaded (aggregate)
 fastest possible upload rate: us + Sui

dP2P = max { F/us, F/mini di) , NF/(us + Sui) }

2: Application Layer 100


Server-client vs. P2P: example
Client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us

3.5
P2P
Minimum Distribution Time

3
Client-Server
2.5

1.5

0.5

0
0 5 10 15 20 25 30 35

N
2: Application Layer 101
Searching for Information-
Query flooding:OGnutella atena!ssat!on
 fully distributed overlay network: graph
o no central server  edge between peer X
 public domain protocol and Y if there’s a TCP
 many Gnutella clients connection
implementing protocol  all active peers and

Tog!cal
es edges is overlay net
network
yeralwaysan  Edge is not a physical

h
I
sub link
 Given peer will
typically be connected
with < 10 overlay
neighbors

Repeers has
f!le a
the
"who
!mal D
threshold 2: Application Layer 102
degree should reach the
peers
parallel
not all

mad!gS!
>
no
-

Gnutella: protocol dowload!ng

we
=> creates the
all rece!ve d
peers
:

problem the Query loads for each


File transfer:
 Query message peer
sent over existing TCP

HTTP JP2P
connections
Query
 peers forward ve
QueryHit
Query message
 QueryHit
sent over
*che h!t forward
sende
as
reverse
path
Query f!
SEARCHINGSeats up QueryHit

keep
the f!ll
l!st 4 no to
Scalability: the
very
resources 9
limited scope
flooding · not sers the
2: Application Layer 103
Gnutella: Peer joining
1. Joining peer X must find some other peer in
Gnutella network: use list of candidate peers
2. X sequentially attempts to make TCP with peers
on list until connection setup with Y
3. X sends Ping message to Y; Y forwards Ping
message.
4. All peers receiving Ping message respond with
Pong message
5. X receives many Pong messages. It can then
setup additional TCP connections

2: Application Layer 104


load !dea
star mesh topology + less com. same
- as
Skype
Exploiting heterogeneity: KaZaA Quey!
download!ng
parallel not by

 Each peer is either a e


ordar change

group leader or assigned groer between same
to a group leader. d!s
f!nct!on
developer
peersetwork
o TCP connection between classteran Te
leaders
peer and its group leader. app O mehmet
o TCP connections between
some pairs of group
leaders.
 Group leader tracks the

-
by
track
Thede
content in all its
children.
appl!cat!on
on
tue
ge 100
ordinary peer

group-leader peer
eet!ngTegece en
·
bl ,

stay long
data

!n
peer
connected

comm , good bu

d!ces
a
peer jo!ns the the
based
ass!gned roll on
leader neighoring relationships => ass!gne a

group
TCP connect!on !s roord!nary in overlay network these parameters
peers leave - choose new

the f!les that other they can


share one t soft sw!tch!ng
alternat!ve
ass!gned
an

vo-
as
group
2: Application Layer 105 leader

prev!ously
KaZaA: Querying
 Each file has a hash and a descriptor
 Client sends keyword query to its group
leader
 Group leader responds with matches:
o For each match: metadata, hash, IP address
 If group leader forwards query to other
group leaders, they respond with matches
 Client then selects files for downloading
o HTTP requests using hash as identifier sent to
peers holding desired file

2: Application Layer 106


transfer HTTP
f!le/data
Kazaa tricks
>
-

used range request


header l!ne range
[0 , zug]
Rangel :

(250, 499]
Bytes Rangez
:
1000

Limitations on simultaneous uploads


Ra
 :

send range request


Request queuing
per each
w!th
 download each
range
put
them
d!fferent peer U

Incentive priorities
access the data
!n order >
-

 Parallel downloading mult!ply query mult!ple peers >


-
n!t from

another
upload f!le (a peerl should w!ll!ng to

shar!ng
-
-

the f!le
download much share
-
how
you
!nsent!ve for share

shared
grade
>
- how much
you shoret
as
of
request - put !n front quere

2: Application Layer 107


groupsetsedT Te
te

P2P Case Study: BitTorrent


- havenonk

P2P file distribution


tracker: tracks peers torrent: group of
!n
l!st of peers -
torrent

participating in torrent peers exchanging


chunks of a file (256 Kp)

no range request
d!v!ded !n
f!le already
chunks
obtain list "parallel" download!ng
of peers
same
share
chunks
t
as the range reques
trading
chunks

peer

2: Application Layer 108


get
!nto torment+
!n!t!ally no chunk
of
ava!lable !n smallest number peers
where to start -
leave
order chunks - how many peer have !t -


they may
loose that
to not
cunk

BitTorrent (1)
 file divided into 256KB chunks.
 peer joining torrent:
o has no chunks, but will accumulate them over time
o registers with tracker to get list of peers,
connects to subset of peers (“neighbors”)
 while downloading, peer uploads chunks to other
peers.
 peers may come and go
 once peer has entire file, it may (selfishly) leave or
(altruistically) remain
2: Application Layer 109
BitTorrent (2) Sending Chunks: tit-for-tat
 Alice sends chunks to four
Pulling Chunks
neighbors currently
 at any given time,
sending her chunks at the
different peers have highest rate requestmayoat
different subsets of ↑ op4 +

 re-evaluate top 4 every


file chunks -

10 secs
 periodically, a peer
 every 30 secs: randomly
(Alice) asks each
neighbor for list of select another peer,
chunks that they have. starts sending chunks
 newly chosen peer may
 Alice sends requests
for her missing chunks join top 4
 “optimistically unchoke”
o rarest first
randomly choose request
a out of

top h send the respond


2: Application Layer 110
e
P2P Case study: Skype same

 inherently P2P: pairs


eto
Skype clients (SC)

of users communicate. the


 proprietary Skype
application-layer login server Supernode
protocol (inferred via (SN)
reverse engineering)
 hierarchical overlay
with SNs
 Index maps usernames
to IP addresses;
distributed over SNs

2: Application Layer 111


leader" term
no
"group
mode" !s used

Skype: making a call "Super


!t's ass!gned !n

log!n process
 User starts Skype
 SC registers with SN
o list of bootstrap SNs Skype
login server
 SC logs in
(authenticate)
 Call: SC contacts SN with
callee ID
o SN contacts other SNs
(unknown protocol, maybe
flooding) to find addr of
callee; returns addr to SC !s used
 SC directly contacts callee PIP com

2: Application Layer 112


Peers as relays
 Problem when both
Alice and Bob are
behind “NATs”.
o NAT prevents an outside
peer from initiating a call
to insider peer
 Solution:
o Using Alice’s and Bob’s
SNs, Relay is chosen
o Each peer initiates
session with relay.
o Peers can now
communicate through
NATs via relay

2: Application Layer 113


v! has more control !n t!me vs TCP ?

handskake

UDP
segment s!ze control !n

e
#
segment

2) P!pel!ng -
pers!stent

d!sadvantage +> server


po!nt
low
comp resources
>
enough !se
-

sorun

U
short t!me
Storage
3) on - use
ve

not
always-on
over all rel!ab!l!ty
4) DNS

problem of prov!de correct !nfo ?

not to date
up
IP addresses
may change
!ncorrect !nfo - can't connect to host

!nfo ?
cash!ng up-to-date
+

You might also like