Professional Documents
Culture Documents
CMPT 371: What Is in The Application Layer
CMPT 371: What Is in The Application Layer
Client
Client
Client
Client
Client
5
Client
Client
Client
Client
Skype
Voice over IP is a P2P application
Your client accesses a centralized server to
manage addresses and memberships
Janice Regan Sept. 2007-2016
Communication between
processes
In order to build an application that
communicates between processes (on the same
or different hosts) need a way to send
information, (data messages) from one process
to another.
To write a user application you need not know
how this communication works in detail, but you
need a set of services that allows you to send
messages.
The interface for sending messages will likely be the
interface to the transport layer.
Janice Regan Sept. 2007-2016
Communication between
processes
.
10
Building an application
How do we build a communication channel in an
application?
Usually use the socket API
A socket is one end of a communication connection
A process may include more than one communication
connection, that is more than one socket
Your application will build the needed sockets, then connect
them (or wait for them to be connected to) to the socket at the
other end of the communication.
11
Socket API
Basic ideas: how to use the socket API
A socket is one end of a communication connection
A socket includes
The address of the host running the process (IP address)
The address of the process running on the host (port)
A specification of the transport protocol to use (TCP, UDP).
12
After connection?
What happens after we build our sockets and
connect them to each other so the two
processes can communicate?
The purpose of the connection is to enable the
transfer of information between the processes,
so the next step will be transferring information.
To transfer information we send messages from
one process to the other through the
communication connection
Janice Regan Sept. 2007-2016
13
After connection?
To transfer information we send messages from
one process to the other
The application level protocol developed for the
particular application will define
The types of messages
The syntax of each message (layout and number of
fields)
The semantics of each message (the content of each
field, its meaning and use)
Rules for processing each type of message and
building replies
Janice Regan Sept. 2007-2016
14
Transport requirements
Some application will tolerate some data loss
Voice, some interactive games, and video will
file transfer, many web apps, and email will not
15
16
17
protocol
SMTP [RFC 2821]
Telnet [RFC 854]
HTTP [RFC 2616]
FTP [RFC 959]
18
CMPT 371
Data Communications and Networking
HTTP
19
HTTP
HyperText Transfer Protocol
The main application layer communication protocol of
the world wide web (WWW)
20
WWW: objects
When we use WWW we provide a URL
and expect to see the web page displayed
by our browser
Each web page is made up of many
objects including images, text, audio or
video clips, animations, applets and other
components
21
WWW: objects
Each web page is described by an HTML
file
The HTML file will include a reference (a
separate URL) for each of the objects on the
page. The HTML file is an object
After the HTML file is requested and received
in response to the HTML request, the objects
embedded in it can be individually requested
All the requested embedded objects can then
be assembled in the displayed page
Janice Regan Sept. 2007-2016
22
23
24
25
26
Non-persistent connections
In the original version (1.0) of HTTP it was
assumed that a TCP connection would be made
to transfer each object.
As soon as the single object had been
transferred the connection would be terminated
A new connection would be made for the next
object that needed transferring between the
same client server pair
27
Non-persistent connections
Early web pages contained one or a very small
number of objects, this was not a critical
problem
Today web pages contain many objects and the
extra load of creating and terminating
connections would place a significant extra load
on the internet
A nonpersistant connection transports at most 1
HTTP request and 1 HTTP reply
Janice Regan Sept. 2007-2016
28
Non-persistent connection
Host A
Request TCP
connection (SYN)
Acknowledge acceptance
(ACK) and HTTP GET
request object
Host B
(SYN, ACK)
Accept TCP
connection
HTTP OK
send object
10
non-persistent connections
Each time a non persistent connection is
made, it is necessary to initialize and
terminate a TCP connection
Send request to make/break connection A-B
Send back a response agreeing to
make/break connection (B-A)
Send an acknowledgement that the
connection has been made/terminated.
Janice Regan Sept. 2007-2016
30
31
Persistent connections
In the late 1990s HTTP 1.1 came into use
The default in HTTP1.1 is a persistent
connection
When a web page is requested the client
requests a TCP connection to the Web server
Many objects on the requested web page are
then transferred through that connection before
it is terminated.
32
11
Persistent connections
In fact when the web page has been completely
sent the connection will remain open
It is likely if one page has been retrieved from the
server another will be retrieved soon after
33
Persistent connection
Host A
(SYN)
Host B
(SYN, ACK)
(ACK)
HTTP GET request object 1
With Piggyback ACK
(FIN)
(ACK)
34
Persistent connections
Each time an object is sent through a
persistent connection
Send request for the object to the server
Send back a response containing the object
Send an acknowledgement that the object
has been received
35
12
36
Pipelining
A series of objects can be requested
As the users agent tries to display a web
page it may encounter embedded objects
that need to be requested
With pipelining these objects are requested
as soon as the agent knows they are needed.
At the web server the requests are queued
and replied to (by sending the object)
sequentially
Janice Regan Sept. 2007-2016
37
Pipelining
A series of objects can be requested
At the web server the requests are queued
and replied to sequentially
As soon as the web server has transmitted
one object it can begin servicing the next
request (sending the next object)
Eventually all requests have been serviced
and the connection becomes idle
After the connection is idle for a short time
(usually 10s of seconds) it will be closed
Janice Regan Sept. 2007-2016
38
13
Host B
(SYN, ACK)
request object 2
send object
1
request object n
send object
2
Transmission
time object 1
Transmission
send object n time object n
Acknowledge
object n (ACK)
(FIN, ACK)
Janice Regan Sept. 2007-2016
(FIN)
(ACK)
39
14