Professional Documents
Culture Documents
Lecture 7 - Application
Lecture 7 - Application
Application Layer
HEDSPI Project
Hanoi University of Technology
by
Ngo Hong Son
1
Overview
Last weeks : Transport Layer
Principles of transport layer
TCP and UDP
Concept of congestion and flow control
Today: Application Layer
Principles of the application layer
Case study: HTTP, Mail, FTP…
2
Basic concepts
3
Remind of protocol stack
Application Supporting network applications
(HTTP, Mail, …)
Network
Routing and forwarding packet among
(IP, ICMP…) networks
7
Processes communication over
Internet
Socket: an interface between
application process and host or host or
server server
transport layer
Socket is identified by controlled by
Port number app developer
process process
IP address socket
socket
Type of transport service (TCP transport
transport
or UDP) layer Internet layer
Socket API (Application services services
8
Service communication model
Client-server
Peer-to-Peer (P2P)
Hybrid
9
Client-Server
Clients
client Send request to server
Do not connect directly
client to other clients
Servers
Wait request from server
client
Server Always-on, always-
connected computer
May have several ones
for scalability
client
e.g. Web, Mail, …
10
Pure P2P
Peer Peer
No central server
Every computer (peer) has the
same role
Arbitrary peers may connect
Peer directly
Peer May occasionally leave-off the
network
E.g. Gnutella
Peer Peer
11
Hybrid P2P and Client-Server
Client
Central server are used
to managed client (Log-in
info., searching info., …)
Clients can connect
directly after logging in.
Server
E.g. Skype
Skype servers manage
user accounts, log-in
session
Client Client One connected, peers can
communicate an VoIP
session directly
Client-Server Comm.
12
P2P Comm.
Case study
13
HTTP and Web
Web clients
WWW: World Wide Web
Share HTML (HyperText
Markup Language) documents htt
over Internet IE p req
htt ue Web
p res st
HTTP: HyperText Transfer po server
ns
Protocol e
Client/Server model
Client requests web objects and Firefox
display them on a web browser est
u
Server: Receive request and r eq n se
p po
htt s
send response to client p re
ht t
14
Navigator
How does HTTP work?
Server opens a listening TCP socket at port 80
(default)
Client initializes a TCP connection to server
Server accepts connection request
Client and Server exchange HTTP messages
(Application level protocol)
HTTP Request
HTTP Response
TCP connection closed
15
HTTP request message
ASCII format (can be read as text)
request line
(GET, POST, GET /dccn/index.html HTTP/1.1
HEAD commands) Host: www.it-hut.edu.vn
User-agent: Mozilla/4.0
header Connection: close
lines Accept-language:en-us
CR, LF
(extra carriage return, line feed)
indicates end
of message
16
HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection close
Date: Tue, 16 Mar 2008 12:00:15 GMT
header Server: Apache/1.3.0 (Unix)
lines Last-Modified: Mon, 15 Mar 2008 …...
Content-Length: 8990
Content-Type: text/html
17
HTTP connections
Non-persistent HTTP Persistent HTTP
At most one object is sent Multiple objects can be sent
over a TCP connection. over single TCP connection
HTTP/1.0 uses between client and server.
nonpersistent HTTP HTTP/1.1 uses persistent
HTTP 1.0: RFC 1945 connections in default mode
HTTP 1.1: RFC 2068
18
Non-Persistent HTTP in action
Web client Web server
Time Time
Persistent HTTP in action
Web client Web server
Send images 2
Stop-and- Pipeline
request images 10 wait! 20
Time Time
Persistent HTTP with pipeline
Web client Web server
21
Time Time
Request message: Method types
HTTP/1.0 HTTP/1.1
GET GET, POST, HEAD
POST PUT
23
Caching
“Cache”: Buffer memory www.xyz.com/index.htm
24
Solution: Web caches (proxy server)
28
Electronic Mail
MUA (Mail User Agent) Protocol for sending mail:
Read email from server, STMP-Simple Mail Transfer
e.g. Outlook, Thunderbird… Protocol
MTA (Mail Transfer Agent): Protocol for accessing mail
Mail boxes for incoming mails of POP – Post Office Protocol
users IMAP – Internet Mail Access
Message queue for outgoing mails Protocol
e.g. Sendmail, MS Exchange…
IMAP IMAP
mail mail
POP POP
user server SMTP server user
agent agent
SMTP SMTP 29
30
Mail access protocols
SMTP SMTP access user
user
agent protocol agent
31
Web Mail service
Use Web browser as an MUA
HTTP is used between MUA and MTA
Mails are also kept on server
E.g.
Gmail,
Hotmail,
Yahoo! Mail, etc.
Nowadays, many server allows web interface to mail
services
http://mail.hut.edu.vn
http://mail.fit.hut.edu.vn
32
Mail message format
SMTP: protocol for exchanging
email msgs
header
blank
RFC 822: standard for text line
message format:
header lines, e.g.,
body
To:
From:
Subject:
body
the “message”, ASCII
characters only
33
Message format: multimedia extensions
MIME: multimedia mail extension, RFC 2045, 2056
additional lines in msg header declare MIME content
type
From: alice@crepes.fr
MIME version To: bob@hamburger.edu
Subject: Picture of yummy crepe.
method used MIME-Version: 1.0
to encode data Content-Transfer-Encoding: base64
Content-Type: image/jpeg
multimedia data
type, subtype, base64 encoded data .....
parameter declaration .........................
......base64 encoded data
encoded data
34
File Transfer Protocol
35
FTP: File Transfer Protocol
TCP control
connection, port 21
user FTP FTP
interface client server
TCP data
user connection, port 20
37
FTP client
Command line
40
Acknowledgement
This course materials contains charts and texts
provided by Keio University, Japan
Some materials from the textbook “Computer
Network, a top down approach” J.F Kurose and
K.W. Ross
41