0% found this document useful (0 votes)
9 views31 pages

Understanding Application Layer Protocols

The document discusses the application layer of data communication and networking, focusing on network applications, application-layer protocols, and their paradigms such as client-server and peer-to-peer. It explains the HTTP protocol used for web communication, including its structure, request/response messages, and persistent connections. Additionally, it covers web documents, cookies, and user-server interactions, including authentication mechanisms.

Uploaded by

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

Understanding Application Layer Protocols

The document discusses the application layer of data communication and networking, focusing on network applications, application-layer protocols, and their paradigms such as client-server and peer-to-peer. It explains the HTTP protocol used for web communication, including its structure, request/response messages, and persistent connections. Additionally, it covers web documents, cookies, and user-server interactions, including authentication mechanisms.

Uploaded by

Fahad Farooqui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Application Layer

Data Communication & Networking II— CS- 512

Department of Computer Science, UBIT

1
Network applications:
Process: program User agent: interfaces
running within a host. with user “above” and
 within same host, two network “below”.
processes  implements user

communicate using interface &


interprocess application-level
communication protocol
(defined by OS).  Web: browser
 processes running in  E-mail: mail reader
different hosts  streaming
communicate with an
audio/video: media
application-layer
player
protocol

2
Applications and application-layer
protocols
Application: communicating,
distributed processes applicatio
n
 e.g., e-mail, Web, P2P file transport
sharing, instant messaging network
data link
 running in end systems physical

(hosts)
 exchange messages to
implement application
Application-layer protocols
 one “piece” of an app
 define messages
exchanged by apps and
actions taken applicatio
applicatio
n
 use communication n transport
transport
services provided by lower network
network
data link
layer protocols (TCP, UDP) data link
physical
physical

3
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  eg, HTTP, SMTP
messages & how fields
are delineated Proprietary protocols:
 Semantics of the fields,  eg, KaZaA

ie, meaning of
information in fields THREE PARADIGMS
 Rules for when and • Client server
how processes send & • Peer-to-Peer
respond to messages • Hybrid

4
Client-server paradigm

Typical network app has applicatio

two pieces: client and n


transport
network
server
Client:
data link
physical
request
 initiates contact with server
(“speaks first”)
 typically requests service from
server,
 Web: client implemented in reply
browser; e-mail: in mail reader applicatio
n
Server: transport
network
data link
 provides requested service to client physical

 e.g., Web server sends requested Web


page, mail server delivers e-mail

5
Peer-to-Peer paradigm
 Peers communicate with each other
 Peers are desktop/laptops controlled by users
 Communication is without passing through a
dedicated server
 Examples: File distribution application (Bit Torrent,
Lime wire, eMule), Internet Telephony (Skype), IPTV
(PPLive)
 Hybrid Applications are instant messaging services
(MSN, Yahoo)
 Servers are used to track peer IP address and

messages are exchanged between users without


passing through intermediate servers

6
Internet apps: their protocols and
transport protocols
Application Underlying
Application layer protocol transport protocol

e-mail smtp TCP


remote terminal access telnet TCP
Web http TCP
file transfer ftp TCP
streaming multimedia proprietary TCP or UDP
(e.g. RealNetworks)
remote file server NSF TCP or UDP
Internet telephony proprietary typically UDP
(e.g., Vocaltec)

7
WWW: the http protocol

http: hypertext transfer


protocol htt
pr
 WWW’s application layer equ
PC running htt est
protocol pr
Explorer esp
ons
 client/server model e
 client: browser that
e st
requests, receives, eq
u
r e Server
“displays” WWW objects ttp o ns
h p running
r es
 server: WWW server p NCSA Web
htt
server
sends objects in response
to requests
Mac running
Navigator

8
WWW: the http protocol
 The WWW today is a distributed client/server
service, in which a client using a browser can
access a service using a server.
 However, the service provided is distributed over
many locations called sites.

 Each site holds one or more documents, referred


to as Web pages.

 The request, among other information, includes


the address of the site and the Web page, called
the URL

9
Architecture of WWW

10
Client (Browser)
 Each browser usually consists of three parts: a controller, client protocol,
and interpreters.
 The controller receives input from the keyboard or the mouse and uses the
client programs to access the document.
 After the document has been accessed, the controller uses one of the
interpreters to display the document on the screen.
 The client protocol can be one of the protocols described previously such as
FTP or HTTP.
 The interpreter can be HTML, Java, or JavaScript, depending on the type
of document.

11
URL
 To facilitate the access of documents distributed
throughout the world, HTTP uses locators.
 The uniform resource locator (URL) is a standard for
specifying any kind of information on the Internet.
 The URL defines four things: protocol, host
computer, port, and path

12
Cookies
 A cookie, also known as an HTTP cookie, web cookie, or
browser cookie, is a small piece of data sent from a website and
stored in a user's web browser while the user is browsing that
website.
 Every time the user loads the website, the browser sends the
cookie back to the server to notify the website of the user's
previous activity.

 Cookies were designed to be a reliable mechanism for websites


to remember stateful information (such as items in a shopping
cart) or to record the user's browsing activity (including
clicking particular buttons, logging in, or recording which pages
were visited by the user as far back as months or years ago).

13
WEB DOCUMENTS

 The documents in the WWW can be grouped into three


broad categories: static, dynamic, and active.

 The category is based on the time at which the contents of


the document are determined.

14
Static document

When a client accesses the document, a copy of the document is


sent. The user can then use a browsing program to display the
document

15
Dynamic document using CGI
 A dynamic document is created by a Web server whenever a
browser requests the document.
 When a request arrives, the Web server runs an application
program or a script that creates the dynamic document. The
server returns the output of the program or script as a response
to the browser that requested the document.

16
ynamic document using server-site script

Dynamic documents are sometimes referred to as server-site


dynamic documents.

17
Active document using Java applet

Active document using client-site script

Active documents are


sometimes referred to as
client-site dynamic
documents.

18
HTTP
 The Hypertext Transfer Protocol (HTTP) is a protocol used
mainly to access data on the World Wide Web. HTTP functions
as a combination of FTP and SMTP.
 It is similar to FTP because it transfers files and uses the
services of TCP.
 However, it is much simpler than FTP because it uses only one
TCP connection. There is no separate control connection; only
data are transferred between the client and the server.
HTTP uses the services of TCP on well-known port 80.

19
equest and response messages

20
The http protocol: more
http: TCP transport service: 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  so that the communication
http messages (application-layer consists of independent pairs
protocol messages) exchanged of request and response
between browser (http client) and  Protocols that maintain “state”
WWW server (http server) are complex!
TCP connection closed

21
http example
Suppose user enters URL
[Link]/CEDt/[Link] (contains text, references
to 10 jpeg images)

1a. http client initiates TCP


connection to http server
(process) at [Link].
1b. http server at host
[Link] waiting for
Port 80 is default for http server.
TCP connection at port 80.
“accepts” connection,
notifying client
2. http client sends http
request message
(containing URL) into TCP 3. http server receives request
connection socket message, forms response
message containing
requested object
time (CED/[Link]), sends
message into socket

22
http example (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
6. Steps 1-5 repeated for each
of 10 jpeg objects
time

23
HTTP persistent connection
 HTTP persistent connection, also called HTTP keep-alive, or
HTTP connection reuse, is the idea of using a single TCP
connection to send and receive multiple HTTP
requests/responses, as opposed to opening a new connection
for every single request/response pair
HTTP 1.1
 In HTTP 1.1, all connections are considered persistent unless
declared otherwise. The HTTP persistent connections do not
use separate keepalive messages, they just allow multiple
requests to use a single connection.

24
Advantages Persistent connection
 Lower CPU and memory usage (because fewer connections are
open simultaneously).

 Enables HTTP pipelining of requests and responses.

 Reduced network congestion (fewer TCP connections).

 Reduced latency in subsequent requests (no handshaking).

 Errors can be reported without the penalty of closing the TCP


connection.

25
Persistent V/s Non persistent

 non-persistent
connection: one object
in each TCP
connection
 some browsers

create multiple
TCP connections
simultaneously -
one per object
 persistent connection:
multiple objects
transferred within one
TCP connection

26
http message format: request
 two types of http messages: request, response
 http request message:
 ASCII (human-readable format)

request line
(GET, POST,
GET /somedir/[Link] HTTP/1.1
HEAD commands)
Connection: close
header User-agent: Mozilla/4.0
lines Accept: text/html, image/gif,image/jpeg
Accept-language:fr
Carriage return,
line feed
(extra carriage return, line feed)
indicates end
of message
27
http request message: general format

28
http message format: reply

status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection: close
Date: Thu, 06 Aug 2011 [Link] GMT
header Server: Apache/1.3.0 (Unix)
lines Last-Modified: Mon, 22 Jun 2011 …...
Content-Length: 6821
Content-Type: text/html
data data data data data ...

data, e.g.,
requested
html file

29
http reply 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
 request message not understood by server
404 Not Found
 requested document not found on this server
505 HTTP Version Not Supported

30
User-server interaction:
authentication
 Authentication goal: control
access to server documents client server
 stateless: client must present usual http request
authorization in each request msg
401: authorization
 authorization: typically name, req.
password WWW authenticate:
 authorization: header line in
usual http request
request msg
 if no authorization presented, + Authorization:line
usual http response
server refuses access, sends
msg
 WWW authenticate:
 header line in response usual http request
msg
+ Authorization:line time
usual http response
msg

31

You might also like