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

CNDC Lecture 08 Application Layer

The document discusses the application layer of computer networks and data communication. It covers various popular application layer protocols like HTTP, FTP, SMTP, and DNS. It describes client-server and peer-to-peer application architectures. It discusses how applications use sockets to communicate over networks and the need for unique identifiers like IP addresses and port numbers for processes. It also examines common network application requirements and how TCP and UDP meet different transport needs.

Uploaded by

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

CNDC Lecture 08 Application Layer

The document discusses the application layer of computer networks and data communication. It covers various popular application layer protocols like HTTP, FTP, SMTP, and DNS. It describes client-server and peer-to-peer application architectures. It discusses how applications use sockets to communicate over networks and the need for unique identifiers like IP addresses and port numbers for processes. It also examines common network application requirements and how TCP and UDP meet different transport needs.

Uploaded by

Intelligence 01
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 31

Computer Networks & Data

Communication
Course Instructor:
Ms. Mehr un Nisa
Application Layer: outline
1 principles of network 6 socket programming
applications with UDP and TCP
 app architectures
 app requirements
2 Web and HTTP
3 FTP
4 electronic mail
 SMTP, POP3, IMAP
5 DNS
Application layer
our goals:  learn about protocols by
 conceptual, examining popular
implementation aspects application-level
of network application protocols
protocols  HTTP
 transport-layer  FTP
service models  SMTP / POP3 / IMAP
 client-server  DNS
paradigm  creating network
 peer-to-peer applications
paradigm  socket API
Some network apps
 e-mail  voice over IP (e.g., Skype)
 web  real-time video
 text messaging conferencing
 remote login  social networking
 P2P file sharing  search
 multi-user network games  …
 streaming stored video  …
(YouTube, Hulu, Netflix)
Creating a network app application
transport
network
data link

write programs that: physical

 run on (different) end systems


 communicate over network
 e.g., web server software
communicates with browser
software

no need to write software for application

network-core devices transport


network
application
data link
 network-core devices do not physical transport
network
run user applications data link
physical

 applications on end systems


allows for rapid app
development, propagation
Application architectures
possible structure of applications:
 client-server
 peer-to-peer (P2P)
Processes communicating
process: program running clients, servers
within a host client process: process that
 within same host, two initiates communication
processes communicate server process: process
using inter-process that waits to be contacted
communication (defined by
OS)
 processes in different hosts
communicate by  aside: applications with P2P
exchanging messages architectures have client
processes & server
processes
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
Addressing processes
 to receive messages, process  identifier includes both IP
must have identifier address and port numbers
 host device has unique 32- associated with process on
bit IP address host.
 Q: does IP address of host  example port numbers:
on which process runs  HTTP server: 80
suffice for identifying the  mail server: 25
process?  to send HTTP message to
 A: no, many processes gaia.cs.umass.edu web
can be running on same server:
host  IP address: 128.119.245.12
 port number: 80
 more shortly…
App-layer protocol defines
 types of messages open protocols:
exchanged,  defined in RFCs
 e.g., request, response  allows for interoperability
 message syntax:  e.g., HTTP, SMTP
 what fields in messages proprietary protocols:
& how fields are  e.g., Skype
delineated
 message semantics
 meaning of information
in fields
 rules for when and how
processes send & respond
to messages
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 “ effective
tolerate some loss ”
 other apps (“ elastic apps” )

timing make use of whatever


throughput they get
 some apps (e.g., Internet
telephony, interactive security
games) require low delay
 encryption, data integrity,
to be “ effective”

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 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
text messaging no loss elastic yes and no
Internet transport protocols services

TCP service: UDP service:


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

TCP & UDP SSL is at app layer


 no encryption  Apps use SSL
 cleartext passwds sent libraries, which “ talk”
into socket traverse to TCP
Internet in cleartext SSL socket API
SSL  cleartext passwds sent
 provides encrypted into socket traverse
TCP connection Internet encrypted
 data integrity
 end-point
authentication
Application Layer: outline
1 principles of network 6 socket programming
applications with UDP and TCP
 app architectures
 app requirements
2 Web and HTTP
3 FTP
4 electronic mail
 SMTP, POP3, IMAP
5 DNS
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


HTTP overview
HTTP: hypertext transfer
protocol HT
 Web’s application layer TP
req
ues
protocol PC running HT t
Firefox browser TP
 client/server model res
pon
se
 client: browser that
requests, receives, t
(using HTTP protocol) u es
req server
and “ displays” Web T P n se
HT s po running
objects TP
r e Apache Web
T
 server: Web server H server
sends (using HTTP
protocol) objects in iphone running
response to requests Safari browser
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
connection from client aside
protocols that maintain
 HTTP messages “ state” are complex!
(application-layer protocol  past history (state) must be
messages) exchanged maintained
between browser (HTTP  if server/client crashes, their
client) and Web server views of “ state” may be
(HTTP server) inconsistent, must be
 TCP connection closed reconciled
HTTP connections
non-persistent HTTP persistent HTTP
 at most one object sent  multiple objects can
over TCP connection be sent over single
 connection then TCP connection
closed between client, server
 downloading multiple
objects required
multiple connections
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
(process) at 1b. HTTP server at host
www.someSchool.edu on port 80 www.someSchool.edu waiting
for TCP connection at port 80.
“ accepts” connection, notifying
2. HTTP client sends HTTP client
request message (containing
URL) into TCP connection 3. HTTP server receives request
socket. Message indicates that message, forms response
client wants object message containing requested
someDepartment/home.index object, and sends message into
its socket
time
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
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
time to
response to return RTT transmit
 file transmission time file
file
 non-persistent HTTP response received
time =
2RTT+ file transmission time time
time
Persistent HTTP

non-persistent HTTP persistent HTTP:


issues:  server leaves connection
 requires 2 RTTs per object open after sending
 OS overhead for each TCP response
connection  subsequent HTTP
 browsers often open messages between same
parallel TCP connections to client/server sent over
fetch referenced objects open connection
 client sends requests as
soon as it encounters a
referenced object
 as little as one RTT for all
the referenced objects
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
headerAccept-Language: en-us,en;q=0.5\r\n
linesAccept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
carriage return, Keep-Alive: 115\r\n
line feed at start Connection: keep-alive\r\n
\r\n
of line indicates
end of header lines
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
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
Method types
HTTP/1.0: HTTP/1.1:
 GET  GET, POST, HEAD
 POST  PUT
 HEAD  uploads file in entity
 asks server to leave body to path specified
requested object out of in URL field
response  DELETE
 deletes file specified in
the URL field
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
\r\n
data, e.g., data data data data data ...
requested
HTML file
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
Q/A

You might also like