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

CRI Reti 04 Application Layer

The document discusses an overview of the application layer and topics that will be covered, including principles of network applications, web and HTTP, email protocols, DNS, peer-to-peer applications, socket programming, and more. It provides examples of common network applications and how processes communicate over the network using client-server or peer-to-peer architectures. The roles of clients, servers, and processes are defined. Application layer protocols and addressing of processes are also summarized.

Uploaded by

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

CRI Reti 04 Application Layer

The document discusses an overview of the application layer and topics that will be covered, including principles of network applications, web and HTTP, email protocols, DNS, peer-to-peer applications, socket programming, and more. It provides examples of common network applications and how processes communicate over the network using client-server or peer-to-peer architectures. The roles of clients, servers, and processes are defined. Application layer protocols and addressing of processes are also summarized.

Uploaded by

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

Application Layer

Contents:
We will follow more or less (we’ll cut quite a lot) the corresponding chapter of the textbook:
“Computer Networking: a Top-Down Approach” by Jim Kurose and Keith Ross, 8th Ed. (7th is fine as well)

Disclaimers:
▪ Original slides are courtesy of the textbook authors
▪ Main content selection made by dott. Luca Tagliapietra Application Layer: 1-1

▪ Compacting action by prof. Michele Geronazzo


Application layer: overview
▪ P2P applications
▪ Principles of network ▪ video streaming and content
applications distribution networks
▪ Web and HTTP ▪ socket programming
▪ E-mail, SMTP, IMAP (dedicated lab)
▪ The Domain Name System
DNS

Application Layer: 2-2


Some network apps
▪ social networking ▪ voice over IP (e.g., Skype)
▪ Web ▪ real-time video conferencing
▪ text messaging (e.g., Zoom)
▪ e-mail ▪ Internet search
▪ multi-user network games ▪ remote login
▪ streaming stored video ▪…
(YouTube, Hulu, Netflix)
▪ P2P file sharing

Application Layer: 2-4


Creating a network app
application

write programs that: mobile


transport
network
network
data link
physical
▪ run on (different) end systems national or global ISP

▪ communicate over network


▪ e.g., web server software
communicates with browser software
local or
no need to write software for regional ISP

network-core devices home network content


application provider
▪ network-core devices do not run user transport
network network datacenter
applicationnetwork
applications data link
physical
transport
network

▪ applications on end systems allows for


data link
physical

rapid app development, propagation enterprise


network

Application Layer: 2-5


Client-server paradigm
server: mobile network
▪ always-on host national or global ISP

▪ permanent IP address
▪ often in data centers, for scaling
clients: local or

▪ contact, communicate with server


regional ISP

▪ may be intermittently connected home network content


provider
▪ may have dynamic IP addresses network datacenter
network

▪ do not communicate directly with


each other
enterprise
▪ examples: HTTP, IMAP, FTP network

Application Layer: 2-6


Peer-peer architecture
▪ no always-on server mobile network
▪ arbitrary end systems directly national or global ISP

communicate
▪ peers request service from other
peers, provide service in return to
other peers local or
regional ISP
• self scalability – new peers bring new
service capacity, as well as new service home network content
demands provider
network datacenter
▪ peers are intermittently connected network

and change IP addresses


• complex management enterprise
▪ example: P2P file sharing network

Application Layer: 2-7


Processes communicating

process: program running clients, servers


within a host client process: process that
initiates communication
▪within same host, two server process: process
processes communicate that waits to be contacted
using inter-process
communication (defined by
OS) ▪ note: applications with
P2P architectures have
▪processes in different hosts client processes &
communicate by exchanging server processes
messages
Application Layer: 2-8
More in the Lab

Sockets
▪ process sends/receives messages to/from its socket
▪ socket analogous to door
• sending process launches message out door
• sending process relies on transport infrastructure on other side of
door to deliver message to socket at receiving process
• two sockets involved: one on each side

application application
socket controlled by
process process app developer

transport transport
network network controlled
link by OS
link Internet
physical physical

Application Layer: 2-9


An application-layer protocol defines:
▪ types of messages exchanged, open protocols:
• e.g., request, response ▪ defined in RFCs, everyone
▪ message syntax: has access to protocol
• what fields in messages & how definition
fields are delineated ▪ allows for interoperability
▪ message semantics ▪ e.g., HTTP, SMTP
• meaning of information in proprietary protocols:
fields
▪ e.g., Skype, Zoom
▪ rules for when and how
processes send & respond to
messages
Application Layer: 2-11
Addressing processes
▪ to receive messages, process ▪ identifier includes both IP address
must have identifier and port numbers associated with
▪ host device has unique 32-bit process on host.
IP address ▪ example port numbers:
▪ Q: does IP address of host on • HTTP server: 80
which process runs suffice for • mail server: 25
identifying the process?
▪ A: no, many processes
can be running on
same host

Application Layer: 2-12


Application layer: overview
▪ P2P applications
▪ Principles of network ▪ video streaming and content
applications distribution networks
▪ Web and HTTP ▪ socket programming with
▪ E-mail, SMTP, IMAP UDP and TCP
▪ The Domain Name System
DNS

Application Layer: 2-13


Web and HTTP
First, a quick review…
▪ web page consists of objects, each of which can be stored on
different Web servers
▪ object can be HTML file, JPEG image, Java applet, audio file,…
▪ web page consists of base HTML-file which includes several
referenced objects, each addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif

host name path name

Application Layer: 2-14


HTTP overview
HTTP: hypertext transfer protocol
▪ Web’s application-layer protocol
▪ client/server model: PC running
• client: browser that requests, Firefox browser
receives, (using HTTP protocol) and
“displays” Web objects
• server: Web server sends (using server running
Apache Web
HTTP protocol) objects in response server
to requests
iPhone running
Safari browser

Application Layer: 2-15


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

Application Layer: 2-16


HTTP connections: two types
Non-persistent HTTP Persistent HTTP
1. TCP connection opened ▪TCP connection opened to
2. at most one object sent a server
over TCP connection ▪multiple objects can be
3. TCP connection closed sent over single TCP
connection between client,
downloading multiple and that server
objects required multiple ▪TCP connection closed
connections

Application Layer: 2-17


Non-persistent HTTP: example
User enters URL: www.someSchool.edu/someDepartment/home.index
(containing text, references to 10 jpeg images)

1a. HTTP client initiates TCP


connection to HTTP server 1b. HTTP server at host www.someSchool.edu
(process) at www.someSchool.edu on waiting for TCP connection at port 80
port 80 “accepts” connection, notifying client

2. HTTP client sends HTTP


request message (containing
URL) into TCP connection 3. HTTP server receives request message,
socket. Message indicates forms response message containing
time that client wants object requested object, and sends message
someDepartment/home.index into its socket
Application Layer: 2-18
Non-persistent HTTP: example (cont.)
User enters URL: www.someSchool.edu/someDepartment/home.index
(containing text, references to 10 jpeg images)

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

6. Steps 1-5 repeated for


each of 10 jpeg objects
time

Application Layer: 2-19


Non-persistent HTTP: response time

RTT (definition): time for a small


packet to travel from client to initiate TCP
server and back connection
RTT
HTTP response time (per object):
▪ one RTT to initiate TCP connection request file
▪ one RTT for HTTP request and first few RTT time to
transmit
bytes of HTTP response to return file
file received
▪ obect/file transmission time

time time
Non-persistent HTTP response time = 2RTT+ file transmission time
Application Layer: 2-20
Persistent HTTP (HTTP 1.1)
Non-persistent HTTP issues: Persistent HTTP (HTTP1.1):
▪ requires 2 RTTs per object ▪ server leaves connection open after
▪ OS overhead for each TCP sending response
connection ▪ subsequent HTTP messages
▪ browsers often open multiple between same client/server sent
parallel TCP connections to over open connection
fetch referenced objects in ▪ client sends requests as soon as it
parallel encounters a referenced object
▪ as little as one RTT for all the
referenced objects (cutting
response time in half)
Application Layer: 2-21
HTTP request message
two types of HTTP messages: request, response
HTTP request message:
ASCII (human-readable format)
carriage return character
line-feed character
request line
(GET, POST, GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
header Accept-Language: en-us,en;q=0.5\r\n
lines Accept-Encoding: gzip,deflate\r\n
carriage return, Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
line feed at start Keep-Alive: 115\r\n
Connection: keep-alive\r\n
of line indicates \r\n
end of header lines
Application Layer 2-22

* Check out the online interactive exercises for more


examples: http://gaia.cs.umass.edu/kurose_ross/interactive/
HTTP request message: general format

method sp URL sp version cr lf request


line
header field name value cr lf
header
~ ~ lines

header field name value cr lf


cr lf

~ entity body ~ body

Application Layer: 2-23


HTTP response message

status line
(protocol
status code HTTP/1.1 200 OK\r\n
status phrase) Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
header ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
lines Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-8859-
1\r\n
data, e.g., \r\n
requested data data data data data ...
HTML file
Application Layer 2-24

* Check out the online interactive exercises for more


examples: http://gaia.cs.umass.edu/kurose_ross/interactive/
Maintaining user/server state: cookies
Web sites and client browser use Example:
cookies to maintain some state ▪ Susan uses browser on laptop,
visits specific e-commerce site
between transactions for first time
four components: ▪ when initial HTTP requests
1) cookie header line of HTTP response arrives at site, site creates:
message • unique ID (aka “cookie”)
2) cookie header line in next HTTP • entry in backend database
for ID
request message
• subsequent HTTP requests
3) cookie file kept on user’s host, from Susan to this site will
managed by user’s browser contain cookie ID value,
4) back-end database at Web site allowing site to “identify”
Susan
Application Layer: 2-25
Maintaining user/server state: cookies
client
server
ebay 8734 usual HTTP request msg Amazon server
cookie file creates ID
usual HTTP response 1678 for user create backend
ebay 8734 set-cookie: 1678 entry database
amazon 1678

usual HTTP request msg


cookie: 1678 cookie- access
specific
usual HTTP response msg action

one week later:


access
ebay 8734 usual HTTP request msg
amazon 1678
cookie: 1678 cookie-
specific
usual HTTP response msg action
time time Application Layer: 2-33
HTTP cookies: comments
aside
What cookies can be used for: cookies and privacy:
▪ authorization ▪ cookies permit sites to
▪ shopping carts learn a lot about you on
their site.
▪ recommendations ▪ third party persistent
▪ user session state (Web e-mail) cookies (tracking cookies)
allow common identity
(cookie value) to be
Challenge: How to keep state? tracked across multiple
▪ at protocol endpoints: maintain state at web sites
sender/receiver over multiple
transactions
▪ in messages: cookies in HTTP
messages carry state
Application Layer: 2-27
Application Layer: Overview
▪ P2P applications
▪ Principles of network ▪ video streaming and content
applications distribution networks
▪ Web and HTTP ▪ socket programming with
▪ E-mail, SMTP, IMAP UDP and TCP
▪ The Domain Name System
DNS

Application Layer: 2-57


DNS: Domain Name System
people: many identifiers: Domain Name System (DNS):
• SSN, name, passport # ▪ distributed database implemented in
Internet hosts, routers: hierarchy of many name servers
• IP address (32 bit) - used for ▪ application-layer protocol: hosts, DNS
addressing datagrams servers communicate to resolve
• “name”, e.g., cs.umass.edu - names (address/name translation)
used by humans
• note: core Internet function,
Q: how to map between IP implemented as application-layer
address and name, and vice protocol
versa ?
• complexity at network’s “edge”

Application Layer: 2-58


Thinking about the DNS
huge distributed database:
▪ ~ billion records, each simple
handles many trillions of queries/day:
▪ many more reads than writes
▪ performance matters: almost every
Internet transaction interacts with
DNS - msecs count!
organizationally, physically decentralized:
▪ millions of different organizations
responsible for their records
“bulletproof”: reliability, security
Application Layer: 2-60
DNS: a distributed, hierarchical database
Root DNS Servers Root
… …
.com DNS servers .org DNS servers .edu DNS servers Top Level Domain
… … … …
yahoo.com amazon.com pbs.org nyu.edu umass.edu
DNS servers DNS servers DNS servers DNS servers DNS servers Authoritative

Client wants IP address for www.amazon.com; 1st approximation:


▪ client queries 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
Application Layer: 2-61
DNS: root name servers
▪ official, contact-of-last-resort by
name servers that can not resolve
name

Application Layer: 2-62


DNS: root name servers
▪ official, contact-of-last-resort
by name servers that can not 13 logical root name “servers”
worldwide each “server” replicated
resolve name many times (~200 servers in US)
▪ incredibly important
Internet function
• Internet couldn’t function without it!
• DNSSEC – provides security
(authentication, message integrity)
▪ ICANN (Internet Corporation
for Assigned Names and
Numbers) manages root
DNS domain
Application Layer: 2-63
Top-Level Domain, and authoritative servers
Top-Level Domain (TLD) servers:
▪ responsible for .com, .org, .net, .edu, .aero, .jobs, .museums, and all top-level
country domains, e.g.: .cn, .uk, .fr, .ca, .jp
▪ Network Solutions: authoritative registry for .com, .net TLD
▪ Educause: .edu TLD

authoritative DNS servers:


▪ organization’s own DNS server(s), providing authoritative hostname to IP mappings
for organization’s named hosts
▪ can be maintained by organization or service provider

Application Layer: 2-64


Local DNS name servers
▪ when host makes DNS query, it is sent to its local DNS server
• Local DNS server returns reply, answering:
• from its local cache of recent name-to-address translation pairs (possibly out of
date!)
• forwarding request into DNS hierarchy for resolution
• each ISP has local DNS name server; to find yours:
• MacOS: % scutil --dns
• Windows: >ipconfig /all
▪ local DNS server doesn’t strictly belong to hierarchy

Application Layer: 2-65


DNS name resolution: iterated query
root DNS server
Example: host at engineering.nyu.edu
wants IP address for gaia.cs.umass.edu
2 Top-level Domain
3
(TLD) DNS server
Iterated query: 1 4

▪ contacted server replies 8


5
with name of server to requesting host at local DNS server
contact engineering.nyu.edu dns.nyu.edu
gaia.cs.umass.edu
▪ “I don’t know this name, 7 6
but ask this server”
authoritative DNS server
dns.cs.umass.edu

Application Layer: 2-66


DNS name resolution: recursive query
root DNS server
Example: host at engineering.nyu.edu
wants IP address for gaia.cs.umass.edu 3
2
7 6
Recursive query: 1 TLD DNS server
▪ puts burden of name 8
resolution on requesting host at local DNS server
5 4
engineering.nyu.edu dns.nyu.edu
contacted name gaia.cs.umass.edu

server
▪ heavy load at upper authoritative DNS server
levels of hierarchy? dns.cs.umass.edu

Application Layer: 2-67


Caching DNS Information
▪ once (any) name server learns mapping, it caches mapping,
and immediately returns a cached mapping in response to a
query
• caching improves response time
• cache entries timeout (disappear) after some time (TTL)
• TLD servers typically cached in local name servers
▪ cached entries may be out-of-date
• if named host changes IP address, may not be known Internet-wide
until all TTLs expire!
• best-effort name-to-address translation!

Application Layer: 2-68

You might also like