applications-layer-1
applications-layer-1
Application Layer
2: Application Layer 2
1
Chapter 2: Application layer
2.1 Principles of 2.6 P2P applications
network applications 2.7
2 7 Socket programming
2.2 Web and HTTP with UDP
2.3 FTP 2.8 Socket programming
2.4 Electronic Mail with TCP
SMTP, POP3, IMAP
2.5 DNS
2: Application Layer 3
paradigm programming
i network
t k
peer-to-peer
applications
paradigm socket API
2: Application Layer 4
2
Some network apps
e-mail social networks
web voice over IP
instant messaging real-time video
remote login conferencing
P2P file sharing grid computing
multi-user network
g
games
streaming stored video
clips
2: Application Layer 5
3
Chapter 2: Application layer
2.1 Principles of 2.6 P2P applications
network applications 2.7
2 7 Socket programming
2.2 Web and HTTP with UDP
2.3 FTP 2.8 Socket programming
2.4 Electronic Mail with TCP
SMTP, POP3, IMAP
2.5 DNS
2: Application Layer 7
Application architectures
Client-server
Including data centers / cloud computing
Peer-to-peer (P2P)
Hybrid of client-server and P2P
2: Application Layer 8
4
Client-server architecture
server:
always-on host
permanent IP address
server farms for
scaling
clients:
client/server communicate with server
may be intermittently
connected
may have dynamic IP
addresses
do not communicate
directly with each other
2: Application Layer 9
5
Pure P2P architecture
no always-on server
arbitrary end systems
directly communicate peer-peer
peers are intermittently
connected and change IP
addresses
2: Application Layer 11
6
Processes communicating
Process: program running Client process: process
within a host. that initiates
within same host, two
communication
processes communicate Server process: process
using inter-process that waits to be
communication (defined contacted
by OS).
processes in different Note
Note: applications with
hosts communicate by P2P architectures have
exchanging messages client processes &
server processes
2: Application Layer 13
Sockets
process sends/receives
host or host or
server server
messages
g to/from
f its
socket controlled by
app developer
socket analogous to door process process
7
Addressing processes
Q: does IP address of
to receive messages, host on which process
process must have runs suffice for
identifier
f identifying the process?
host device has unique A: No, many processes
32-bit IP address can be running on
Exercise: use ipconfig same
from command prompt to Identifier includes both
get your IP address IP address and port
(Windows) numbers
mb s associated
ss i t d with
ith
process on host.
Example port numbers:
HTTP server: 80
Mail server: 25
2: Application Layer 15
8
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
q
other apps (e.g., file minimum amount of
transfer, telnet) require throughput to be
100% reliable data “effective”
transfer
other apps (“elastic apps”)
Timing make use of whatever
some apps (e.g., g p they
throughput y get
g
I t
Internett ttelephony,
l h
interactive games) Security
require low delay to be Encryption, data
“effective” integrity, …
2: Application Layer 17
2: Application Layer 18
9
Internet transport protocols services
Application Underlying
Application layer protocol transport protocol
2: Application Layer 20
10
Chapter 2: Application layer
2.1 Principles of 2.6 P2P applications
network applications 2.7
2 7 Socket programming
2.2 Web and HTTP with UDP
2.3 FTP 2.8 Socket programming
2.4 Electronic Mail with TCP
SMTP, POP3, IMAP
2.5 DNS
2: Application Layer 21
2: Application Layer 22
11
HTTP overview
HTTP: hypertext
transfer protocol
Web’s application layer PC running
protocol Explorer
client/server model
client: browser that
requests, receives, Server
“displays” Web objects running
Apache
p Web
W
server: Web server
server
sends objects in
response to requests
Mac running
Navigator
2: Application Layer 23
2: Application Layer 24
12
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
between client and
server.
2: Application Layer 25
Nonpersistent HTTP
(contains text,
Suppose user enters URL references to 10
www.someSchool.edu/someDepartment/home.index jpeg images)
time
2: Application Layer 26
13
Nonpersistent HTTP (cont.)
2: Application Layer 27
14
Persistent HTTP
2: Application Layer 29
request line
(GET, POST, GET /somedir/page.html HTTP/1.1
HEAD commands) 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
2: Application Layer 30
15
HTTP request message: general format
2: Application Layer 31
www.somesite.com/animalsearch?monkeys&banana
2: Application Layer 32
16
Method types
HTTP/1.0 HTTP/1.1
GET GET,
GET POST,
POST HEAD
POST PUT
HEAD uploads file in entity
body to path specified
asks server to leave
in URL field
requested object out of
response DELETE
deletes file specified in
the URL field
2: Application Layer 33
data, e
data e.g.,
g d t d
data data
t ddata
t ddata
t ddata
t ...
requested
HTML file
2: Application Layer 34
17
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
q
request message not understood by server
404 Not Found
requested document not found on this server
505 HTTP Version Not Supported
2: Application Layer 35
2: Application Layer 36
18
User-server state: cookies
Example:
Many major Web sites
use cookies Susan always access
Four components: Internet always from PC
1) cookie header line of visits specific e-
HTTP response message commerce site for first
2) cookie header line in time
HTTP request message
3) cookie file kept on when initial HTTP
user’s host, managed by requests
q arrives at site,
user’s
’ bbrowser
site creates:
4) back-end database at
Web site unique ID
entry in backend
database for ID
2: Application Layer 37
2: Application Layer 38
19
Cookies (continued)
aside
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
(Web e-mail)
How to keep “state”:
protocol endpoints: maintain state
at sender/receiver over multiple
transactions
cookies: http messages carry state
2: Application Layer 39
20
More about Web caching
cache acts as both Why Web caching?
client and server reduce response time
typically cache is for client request
installed by ISP reduce traffic on an
(university, company, institution’s access
residential ISP) link.
Internet dense with
caches: enables “poor”
poor
content providers to
effectively deliver
content (but so does
P2P file sharing)
2: Application Layer 41
Caching example
origin
Assumptions servers
average object size =
public
p
11,000,000
000 000 bits Internet
avg. request rate from
institution’s browsers to origin
servers = 15/sec
15 Mbps
delay from institutional router access link
to any origin server and back
institutional
to router = 2 sec network
p LAN
100 Mbps
C
Consequences
utilization on LAN = 15%
utilization on access link = 100%
institutional
total delay = Internet delay +
cache
access delay + LAN delay
= 2 sec + minutes + milliseconds
2: Application Layer 42
21
Caching example (cont)
origin
possible solution servers
increase bandwidth of access
public
p
link to
to, say
say, 100 Mbps Internet
consequence
utilization on LAN = 15%
utilization on access link = 15% 100 Mbps
Total delay = Internet delay + access link
access delay + LAN delay institutional
= 2 sec + msecs + msecs network
p LAN
100 Mbps
often a costly upgrade
institutional
cache
2: Application Layer 43
2: Application Layer 44
22
Conditional GET
23