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

Network

The document provides an overview of the application layer and various application layer protocols. It discusses key concepts like client-server and peer-to-peer architectures, sockets, addressing processes, and how application requirements determine the appropriate underlying transport protocol. Specific application layer protocols covered include HTTP, FTP, SMTP, POP3, IMAP, and DNS. The goals are to learn about popular application layer protocols and how to create network applications using sockets.

Uploaded by

mhww9jqqpj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Network

The document provides an overview of the application layer and various application layer protocols. It discusses key concepts like client-server and peer-to-peer architectures, sockets, addressing processes, and how application requirements determine the appropriate underlying transport protocol. Specific application layer protocols covered include HTTP, FTP, SMTP, POP3, IMAP, and DNS. The goals are to learn about popular application layer protocols and how to create network applications using sockets.

Uploaded by

mhww9jqqpj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Chapter 2

Application Layer

Dr/ Hala Hassan


Chapter 2: outline

2.1 principles of network applications 2.5 P2P applications


2.2 Web and HTTP 2.6 video streaming and content
distribution networks
2.3 electronic mail
• SMTP, POP3, IMAP
2.7 socket programming with UDP
and TCP
2.4 DNS

Application Layer 2-2


Chapter 2: application layer

our goals:
 learn about protocols
 conceptual, by examining popular
implementation application-level
aspects of network protocols
application protocols  HTTP
 transport-layer service
models  FTP
 client-server paradigm  SMTP / POP3 / IMAP
 peer-to-peer paradigm  DNS
 content distribution
networks
 creating network
applications
 socket API

Application Layer 2-3


Some network apps

 e-mail  voice over IP (e.g., Skype)


 web  real-time video conferencing
 text messaging  social networking
 remote login  search
 P2P file sharing  …
 multi-user network games  …
 streaming stored video
(YouTube, Hulu, Netflix)

Application Layer 2-4


Creating a network app application
transport
network
data link
physical
write programs that:
 run on (different) end
systems
 communicate over network
 e.g., web server software
communicates with browser
software
application
no need to write software for network- transport
network
core devices data link application
transport
physical

network-core devices do not


network
 data link

run user applications


physical

 applications on end systems


allows for rapid app
development, propagation
Application Layer 2-5
Application architectures

possible structure of applications:


 client-server
 peer-to-peer (P2P)

Application Layer 2-6


Client-server architecture

server:
 always-on host
 permanent IP address
 data centers for scaling
clients:
 communicate with server
 may be intermittently
client/server connected
 may have dynamic IP
addresses
 do not communicate
directly with each other

Application Layer 2-7


P2P architecture
 no always-on server peer-peer
 arbitrary end systems
directly communicate
 peers request service
from other peers,
provide service in return
to other peers
 self scalability – new peers bring
new service capacity, as well as
new service demands

 peers are intermittently


connected and change IP
addresses
 complex management
Application Layer 2-8
Processes communicating

process: program running within a clients, servers


host
client process: process that
 within same host, two initiates
processes communicate communication
using inter-process server process: process that
communication (defined waits to be contacted
by OS)
 processes in different  aside: applications with P2P
hosts communicate by architectures have client
exchanging messages processes & server
processes
Application Layer 2-9
Sockets

 process sends/receives messages to/from its socket


 socket analogous to door
 sending process shoves message out door
 sending process relies on transport infrastructure on other side of door to
deliver message to socket at receiving process

application application
socket controlled by
process process app developer

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

Application Layer 2-10


Addressing processes

 to receive messages,  identifier includes both IP


process must have address and port numbers
associated with process on
identifier host.
 host device has unique  example port numbers:
32-bit IP address  HTTP server: 80
 Q: does IP address of  mail server: 25
host on which process  to send HTTP message to
runs suffice for gaia.cs.umass.edu web
identifying the process? server:
 A: no, many processes  IP address: 128.119.245.12
can be running on same  port number: 80
host  more shortly…
Application Layer 2-11
App-layer protocol defines

 types of messages open protocols:


exchanged,  defined in RFCs
 e.g., request, response
 allows for
 message syntax: interoperability
 what fields in messages & how
fields are delineated  e.g., HTTP, SMTP
 message semantics proprietary protocols:
meaning of information in fields

 e.g., Skype
 rules for when and how
processes send &
respond to messages

Application Layer 2-12


What transport service does an app need?

data integrity throughput


 some apps (e.g., file transfer,  some apps (e.g.,
web transactions) require multimedia) require
100% reliable data transfer minimum amount of
 other apps (e.g., audio) can throughput to be
tolerate some loss “effective”
 other apps (“elastic apps”)
timing make use of whatever
 some apps (e.g., throughput they get
Internet telephony, security
interactive games)  encryption, data integrity,
require low delay to be …
“effective”
Application Layer 2-13
Transport service requirements: 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
video:10kbps-5Mbps msec
stored audio/video loss-tolerant same as above yes, few secs
interactive games loss-tolerant few kbps up yes, 100’s
text messaging no loss elastic msec
yes and no

Application Layer 2-14


Internet transport protocols services
TCP service:
UDP service:
 reliable transport between
sending and receiving  unreliable data transfer
process between sending and
 flow control: sender won’t receiving process
overwhelm receiver
 does not provide: reliability,
 congestion control: throttle flow control, congestion
sender when network
overloaded control, timing, throughput
 does not provide: timing, guarantee, security, or
minimum throughput connection setup,
guarantee, security
 connection-oriented: setup
required between client Q: why bother? Why is there
and server processes a UDP?
Application Layer 2-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) TCP or UDP

Application Layer 2-16


Chapter 2: outline
2.1 principles of network applications 2.5 P2P applications
2.2 Web and HTTP 2.6 video streaming and content
distribution networks
2.3 electronic mail
• SMTP, POP3, IMAP
2.7 socket programming with UDP
and TCP
2.4 DNS

Application Layer 2-17


Web and HTTP

First, a review…
 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, e.g.,

www.someschool.edu/someDept/pic.gif

host name path name

Application Layer 2-18


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

iPhone running
Safari browser

Application Layer 2-19


HTTP overview (continued)

uses TCP: HTTP is “stateless”

 client initiates TCP connection  server maintains


no information
(creates socket) to server, about past client
port 80 requests
 server accepts TCP connection
aside
from client
protocols that maintain
 HTTP messages (application- “state” are complex!
layer protocol messages)  past history (state) must be
exchanged between browser maintained
(HTTP client) and Web server  if server/client crashes, their
views of “state” may be
(HTTP server) inconsistent, must be
 TCP connection closed reconciled
Application Layer 2-20
HTTP connections
non-persistent HTTP persistent HTTP
 at most one object sent  multiple objects can be sent
over TCP connection over single TCP connection
 connection between client, server
then closed
 downloading multiple
objects required
multiple connections

Application Layer 2-21


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

1a. HTTP client initiates TCP


connection to HTTP server 1b. HTTP server at host
(process) at www.someSchool.edu waiting
www.someSchool.edu on port for TCP connection at port 80.
80 “accepts” connection, notifying
2. HTTP client sends HTTP request client
message (containing URL) into
TCP connection socket. 3. HTTP server receives request
Message indicates that client message, forms response
wants object message containing requested
someDepartment/home.index object, and sends message into
its socket
timeApplication Layer 2-22
Non-persistent 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

Application Layer 2-23


Non-persistent HTTP: response time

RTT (definition): time for a


small packet to travel from
client to server and back
HTTP response time:
initiate TCP
 one RTT to initiate TCP connection
connection RTT
 one RTT for HTTP request request
and first few bytes of HTTP file
response to return RTT
time to
transmit
 file transmission time file
file
 non-persistent HTTP received
response time =
2RTT+ file transmission time
time time

Application Layer 2-24


Persistent HTTP

non-persistent HTTP issues: persistent HTTP:

 requires 2 RTTs per object  server leaves connection


open after sending response
 OS overhead for each TCP
connection  subsequent HTTP messages
between same client/server
 browsers often open sent over open connection
parallel TCP connections to
 client sends requests as soon
fetch referenced objects
as it encounters a referenced
object
 as little as one RTT for all the
referenced objects

Application Layer 2-25


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-26
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-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

Application Layer 2-28


Method types

HTTP/1.0: HTTP/1.1:

 GET  GET, POST, HEAD


 POST  PUT
 HEAD  uploads file in entity body to
path specified in URL field
 asks server to leave requested
object out of response  DELETE
 deletes file specified in the
URL field

Application Layer 2-29


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-30


HTTP response status codes
 status code appears in 1st line in server-to-
client response message.
 some sample codes:
200 OK
 request succeeded, requested object later in this msg
301 Moved Permanently
 requested object moved, new location specified later in this
msg (Location:)
400 Bad Request
 request msg not understood by server
404 Not Found
 requested document not found on this server
505 HTTP Version Not Supported
Application Layer 2-31
Quiz
 What are the five layers in the Internet protocol stack? What
are the principal responsibilities of each of these layers?
 What advantage does a circuit-switched network have over a
packet-switched network?
 Suppose that the packet length is L= 8000 bits, and that the
link transmission rate along the link to router on the right is R =
100 Mbps.
1. What is the transmission delay?

2. What is the maximum number of packets per second that


can be transmitted by this link?

You might also like