Presentations PPT Unit-2
Presentations PPT Unit-2
Unit-2
Application Layer
Network Applications
A Network application is an application running on one host and provides a
communication to another application running on a different host.
A network application development is writing programs that run on different
end systems and communicate with each other over the network.
In the Web application there are two different programs that communicate
with each other:
✔ Browser program running in the user's host.
✔ Web server program running in the Web server host.
Host Host
Network Applications - Examples
Email
Web
Remote Login
P2P File Sharing
Multi-user Network Games
Streaming Stored Video
(YouTube)
Voice Over IP (Skype)
Real-time Video
Conference
Social Networking
Network Application Architecture
1. Client-Server architecture
2. P2P (Peer to Peer) architecture
1. Client-Server Architecture
Server:
Client
✔ Its always-on host.
✔ It has a fixed IP address.
✔ Large cluster of host – Data Centers.
✔ E.g. Web Server
Client:
✔ It communicate with server.
✔ Its not like continuously connected.
✔ May have dynamic IP addresses.
✔ Do not communicate directly with
each other.
✔ E.g. PCs, Mobiles
Server
2. P2P Architecture
Peers (end systems) directly
Peer communicate.
Get peers request service from
other peers, provide service to
other peers.
✔ Self Scalability – New peers
bring new service capacity, as
well as new service demands.
Peers are alternatingly
connected and change IP
Peer addresses.
✔ Complex management
Peer
Process Communicating
What is Process?
A process is an instance of a program running in a computer.
We can say that process is program under execution.
Within same host, two processes communicate using inter-process
communication (IPC).
Process in different hosts communicate by exchanging messages.
Client process: A process that initiates communication.
Server process: A process that waits to be contacted.
Process
Process P2
P1
Socket
A process sends messages into, and receives messages from; the
network through a software interface called a socket.
A process is similar to a house and its socket is similar to its door.
✔ Sending process passes message out door.
✔ Sending process relies on transport infrastructure on other side of door to
deliver message to socket at receiving process.
Process
application application
socket controlled by
process process app developer
transport transport
network network controlled
link
by OS
link Internet
Socket physical physical
Transport Services to Applications
Recall that a socket is the interface
between the application process
and the transport layer protocol. Reliable Data
Throughput
Transfer
For develop an application, choose
available transport layer protocol.
Pick the protocol with the services
that best match the needs of your
application. Timing Security
Example: Choose either Train or
Airplane transport for travel
between two cities.
Classify services with four
parameters.
Transport Services to Applications
Reliable Data Transfer
Many applications (e.g., email, file Blur image
transfer, financial applications) require
100% reliable data transfer
Required guarantee that data sent by one
end of application is delivered correctly
and completely to the other end of
application.
This guaranteed data delivery service is
called Reliable Data Transfer.
When it will fail to deliver reliable data
transfer, it is acceptable for loss-tolerant
applications.
Loss-tolerant Applications (e.g.,
audio/video) can tolerate some loss.
Transport Services to Applications
Throughput
some apps (e.g., multimedia) require at least amount of throughput to be
“effective”
Bandwidth sensitive application, specific throughput required.
Elastic application can use of as much, or as little, throughput as happens to
be available.
Timing
some apps (e.g., Internet telephony, interactive games) require low delay to
be “effective”
Security
In the sending host, encrypt all data transmitted by the sending process.
In the receiving host, decrypt the data before delivering the data to the
receiving process.
Internet Transport Protocols Services
TCP Service: UDP Services:
Connection-Oriented: A setup Connectionless: No connection
required between client and before two processes start to
server processes communicate.
Reliable data transfer between Unreliable data transfer between
sending and receiving process
sending and receiving process
without error and proper order
Congestion control: To control It does not provide congestion
sender when network control.
overloaded It Does not provide. Reliability,
It does not provide, Timing, at flow control, throughput
least throughput guarantee (not guarantee, security.
preferred in real-time
application)
Internet Applications
Popular internet applications with their application layer and their
underlying transport protocol.
No loss, Elastic
Loss-tolerant Bandwidth
WEB & HTTP
Web
Early 1990, Internet was used only by
researchers, academics, and university
students.
New application WWW arrived in 1994
by Tim Berners-Lee.
World Wide Web - is an information
where documents and other web
resources are identified by URL,
interlinked by hypertext links, and can
be accessed via the Internet.
On demand available, What they want,
When they want it.
Unlike TV and Radio.
Navigate through Websites.
15
Web and HTTP
Web page consists of objects.
Object can be HTML file, JPEG image, Java applet, audio file etc.…
Web page consists of base HTML-file which includes several
referenced objects.
Web Page (e.g Total five objects)
HTTP
Response
HTTP – Cont…
HTTP
✔ Hyper-Text Transfer Protocol
✔ It is Application layer protocol
HT
✔ Client: A browser that requests, TP
req
PC ues
receives, (using HTTP protocol) HT t
(Web Browser) TP
and “displays” Web objects. res
pon
se
✔ E.g. PC, Mobile
t
✔ Server: Web server sends (using ues
req
HTTP protocol) objects in TP nse Server
HT po (Apache Web
s
response to requests. Pr
e
T Server)
HT
✔ E.g. Apache Web Server
Mobile
(Web Browser)
HTTP - Cont...
A client initiates TCP connection (creates socket) to server using
port 80.
A server accepts TCP connection from client.
HTTP messages (application-layer protocol messages) exchanged
between browser (HTTP client) and Web server (HTTP server).
HTTP is “stateless protocol”, server maintains no information
about past client requests.
HTTP connection types are:
1. Non-persistent HTTP
2. Persistent HTTP
NON-PERSISTENT HTTP &
PERSISTENT HTTP CONNECTION
Non-persistent & Persistent Connection
In Client-Server communication, Client
making a series of requests to server,
Server responding to each of the
requests.
Series of requests may be made back
to back or periodically at regular time
interval.
So, Application developer need to
make an important decision;
Should each request/response pair be
sent over a separate TCP connection.
OR should all of the requests and
corresponding responses be sent over
same TCP connection?
21
1. Non-persistent HTTP
A non-persistent connection is closed after the server sends the
requested object to the client.
The connection is used exactly for one request and one response.
For downloading multiple objects it required multiple
connections.
Non-persistent connections are the default mode for HTTP/1.0.
Example:
Transferring a webpage from server to client, webpage consists of
a base HTML file and 10 JPEG images.
Total 11 object are reside on server.
1. Non-persistent HTTP – Cont.…
URL: www.someSchool.edu/someDepartment/home.index
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”
2. HTTP client sends HTTP request connection, notifying client
message (containing URL) into TCP 3. HTTP server receives request
connection socket. Message indicates message, forms response message
that client wants object containing requested object, and
someDepartment/home.index sends message into its socket
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
1. Non-persistent HTTP: Response time
RTT(round-trip time): A time
for a small packet to travel initiate TCP
from client to server and vice connection
RTT
versa.
request
HTTP response time: file
✔ one RTT to initiate TCP time to
RTT transmit
connection. file
✔ one RTT for HTTP request and file
received
first few bytes of HTTP response
to return.
time time
✔ File transmission time
Date: header
Content-Type:
Server:
Last-Modified:
Content-Length:
headerline indicates
header
header
header
line line the
indicates
line
line timethat
indicates
indicatesand date
that
the
the
thethewhen
number
time the
message
object
and HTTP
ofinbytes
date
was
the
response
generated
when
in
entity was
the the byiscreated
object
bodyobject
being
an
HTML and
Apache
wassent.
text.sent
Webby
created or the
lastserver.
server. modified.
HTTP Response Status Codes
A status code appears in 1st line in server-to-client response
message.
Some 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
Requested http version not support
User-Server interactions: Cookie
A small text file that is stored in the user's computer either temporarily for that session only
or permanently on the hard disk.
Cookies provide a way for the Web site to recognize you and keep track of your preferences.
The cookie technology has four components:
1. A cookie header line in the HTTP response message
2. A cookie header line in the HTTP request message
3. A cookie file kept on the user’s end system and managed by the user’s browser
4. A back-end database at the Web site
Authorization Recommendations
Use of Cookies
User session state
Shopping carts (Web, Email)
Cookies - Example
client server
HT proxy
TP ue st
req server re q
HT ues P
client TP t H TT
p o nse
res res origin
pon TP
se HT server
t
ues
req se
TP o n
HT res
p
TP
HT
client origin
server
Web Caches (Proxy Server) – Cont...
A user’s browser can be configured so, user’s HTTP requests are
first directed to the Web Cache.
A browser sends all HTTP requests to cache.
As an example, suppose a browser is requesting the object
http://www.someschool.edu/campus.gif
Object in cache returns to client browser.
Otherwise cache requests object from origin server, then returns
object to client browser.
Reduce response time for client request.
Reduce traffic on an institution’s access link.
Internet dense with caches: Insufficiency for content providers to
effectively deliver content.
Web Caches (Proxy Server) – Example
Example: Institutional Network
and Internet
Reduce response time for client
request.
Reduce traffic on an institution’s
access link.
Internet dense with caches:
Insufficiency for content providers
to effectively deliver content.
FTP (File Transfer Protocol)
File Transfer Protocol (FTP) is the commonly used protocol for
exchanging files over the Network or Internet. Example: Filezilla
FTP uses the Internet's TCP/IP protocols to enable data transfer.
FTP uses client-server architecture.
FTP promotes sharing of files via remote computers with reliable
and efficient data transfer.
POP3
✔ Post Office Protocol – Version 3
IMAP
✔ Internet Mail Access Protocol
A mail access protocol, such as POP3, is used to transfer mail from
the recipient’s mail server to the recipient’s user agent.
POP3 – Post Office Version 3
POP3 is an extremely simple mail access protocol.
With the TCP connection established, POP3 progresses through
three phases: authorization, transaction and update.
In authorization, the user agent sends a username and a
password to authenticate the user.
In transaction, the user agent retrieves messages, mark messages
for deletion, remove deletion marks and obtain mail statistics.
In update, after the quit command by client, ending the POP3
session; the mail server deletes marked messages.
POP3 is designed to delete mail on the server as soon as the user
has downloaded it.
IMAP - Internet Mail Access Protocol
To keeps all messages in one place: at server
The recipient can then move and organize the message into a
new, user-created folder, read the message, delete the message,
move messages from one folder to another and so on.
To allow users to search remote folders for messages matching
specific criteria.
Also permit a user agent to obtain components of messages,
When low-bandwidth connection between the user agent and its
mail server.
In this case, user not to download all of the messages in its
mailbox, particularly avoiding long messages like an audio or video
clip.
DNS - Domain Name System
gaia.cs.umass.edu
DNS name resolution example
root DNS server
Recursive query:
A host at cis.poly.edu wants IP
2 3
address for gaia.cs.umass.edu 7
6
TLD DNS
server
1 8
gaia.cs.umass.edu
DNS – Cont...
Distributed database design is more preferred over centralized design to
implement DNS in the Internet.
A single point of failure: If the DNS server crashes then the entire Internet will
not stop.
Traffic volume: With millions of device and users accessing its services from
whole globe at the same time.
A Single DNS Server cannot handle huge DNS traffic but with distributed system
its distributed and reduce overload on server.
Distant centralized database: A single DNS server cannot be “close to” all the
querying clients.
If it is in New York City, then all queries from Australia must travel to the other
side of the globe, perhaps over slow and congested links cause significant delays.
Maintenance: To keep records for all Internet hosts. it would have to be updated
frequently to account for every new host.
Socket Programming
Socket is interface between application and network.
✔ An application creates a socket.
✔ Two type of socket:
1. TCP Socket – Reliable Transmission
2. UDP Socket – Unreliable Transmission
Once configured the application can pass data to the socket for
transmission and receive data from the socket (transmitted
through the network by some other host).
application application
socket controlled by
process process app developer
transport transport
network network controlled
link
by OS
link Internet
physical physical
Type of Socket
SOCK_STREAM SOCK_DGRAM
✔ E.g. TCP ✔ E.g. UDP
✔ Reliable delivery ✔ Unreliable delivery
✔ In-order guaranteed ✔ No order guarantees
✔ Connection-oriented ✔ Connection-less
✔ Bidirectional ✔ Unidirectional
App D1
App
3 2 3 2
1 D2
socket Dest. 1 socket
D3
Outline - Summary
Principles of Computer Applications
✔ Browser, Web Server, Email, P2P Applications etc…
Application Layer (TCP – UDP Services)
Web (Web Pages – Objects like html, jpeg, mp3, etc…)
HTTP (TCP connection, port-80, persistent & non-persistent conn.),
Request & Response Message format, Cookies, Web caches, FTP,
Port-21
E-mail (User agent, Mail Server, SMTP port - 25), POP3, IMAP
DNS (Domain names to IP Address), hierarchy structure
Socket programming with TCP and UDP (TCP – Sock_Stream, UDP
– Sock_DGram)
THANK YOU