PowerPoint Presentation
Application Layer
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
George Parisis
School of Engineering and Informatics
University of Sussex
Application Layer
2-*
Application layer
Objectives:
conceptual, implementation aspects of network application protocols
transport-layer service models
client-server paradigm
peer-to-peer paradigm
learn about protocols by examining popular application-level protocols
HTTP
SMTP / POP3 / IMAP
DNS
creating network applications
socket API
Application Layer
*
Application Layer
2-*
Outline
Principles of network applications
Electronic mail
SMTP, POP3, IMAP
Web and HTTP
DNS
socket programming with UDP and TCP
Application Layer
*
Application Layer
2-*
Some network apps
e-mail
web
text messaging
remote login
P2P file sharing
multi-user network games
streaming stored video (YouTube, Hulu, Netflix)
voice over IP (e.g., Skype)
real-time video conferencing
social networking
search
…
…
Application Layer
*
Application Layer
2-*
Creating a network app
write programs that:
run on (different) end systems
communicate over network
e.g., web server software communicates with browser software
no need to write software for network-core devices
network-core devices do not run user applications
applications on end systems allows for rapid app development, propagation
application
transport
network
data link
physical
application
transport
network
data link
physical
application
transport
network
data link
physical
Application Layer
*
Application Layer
2-*
Client-server architecture
server:
always-on host
permanent IP address
data centers for scaling
clients:
communicate with server
may be intermittently connected
may have dynamic IP addresses
do not communicate directly with each other
client/server
Application Layer
*
Application Layer
2-*
P2P architecture
no always-on server
arbitrary end systems directly communicate
peers request service from other peers, provide service in return to other peers
self scalability – new peers bring new service capacity, as well as new service demands
peers are intermittently connected and change IP addresses
ISP friendly, Security, Incentives
peer-peer
Application Layer
*
Application Layer
2-*
Processes communicating
process: program running within a host
within same host, two processes communicate using inter-process communication (defined by OS)
processes in different hosts communicate by exchanging messages
client process: process that initiates communication
server process: process that waits to be contacted
applications with P2P architectures have client processes & server processes
clients, servers
Application Layer
*
Application Layer
2-*
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
API between application and network
Internet
controlled
by OS
controlled by
app developer
transport
application
physical
link
network
process
transport
application
physical
link
network
process
socket
Application Layer
*
Application Layer
2-*
Addressing processes
to receive messages, process must have identifier
host device has unique 32-bit IP address (or more)
Q: does IP address of host on which process runs suffice for identifying the process?
A: no, many processes can be running on same host
identifier includes both IP address and port numbers associated with process on host.
example port numbers:
HTTP server: 80
mail server: 25
to send HTTP message to gaia.cs.umass.edu web server:
IP address: 128.119.245.12
port number: 80
more shortly…
Application Layer
*
Application Layer
2-*
Application layer protocol defines
types of messages exchanged:
e.g., request, response
message syntax:
what fields in messages & how fields are delineated
message semantics
meaning of information in fields
rules for when and how processes send & respond to messages
open protocols:
defined in RFCs
allows for interoperability
e.g., HTTP, SMTP
proprietary protocols:
e.g., Skype
Application Layer
*
Application Layer
2-*
What transport service does an app need?
data integrity
some apps (e.g., file transfer, web transactions) require 100% reliable data transfer
other apps (e.g., audio) can tolerate some loss
timing
some apps (e.g., Internet telephony, interactive games) require low delay to be “effective”
throughput
some apps (e.g., multimedia) require minimum amount of throughput to be “effective”
other apps (“elastic apps”) make use of whatever throughput they get
security
encryption, data integrity, …
Application Layer
*
Application Layer
2-*
Transport service requirements: common apps
application
file transfer
e-mail
Web documents
real-time audio/video
stored audio/video
interactive games
text messaging
data loss
no loss
no loss
no loss
loss-tolerant
loss-tolerant
loss-tolerant
no loss
throughput
elastic
elastic
elastic
audio: 5kbps-1Mbps
video:10kbps-5Mbps
same as above
few kbps up
elastic
time sensitive
no
no
no
yes, 100’s msec
yes, few secs
yes, 100’s msec
yes and no
Application Layer
*
Application Layer
2-*
Internet transport protocols services
TCP service:
reliable transport between sending and receiving process
flow control: sender won’t overwhelm receiver
congestion control: throttle sender when network overloaded
does not provide: timing, minimum throughput guarantee, security
connection-oriented: setup required between client and server processes
UDP service:
unreliable data transfer between sending and receiving process
does not provide: reliability, flow control, congestion control, timing, throughput guarantee, security, or connection setup
Q: why bother? Why is there a UDP?
Application Layer
*
Application Layer
2-*
Internet apps: application, transport protocols
application
e-mail
remote terminal access
Web
file transfer
streaming multimedia
Internet telephony
application
layer protocol
SMTP [RFC 2821]
Telnet [RFC 854]
HTTP [RFC 2616]
FTP [RFC 959]
HTTP (e.g., YouTube),
RTP [RFC 1889]
SIP, RTP, proprietary
(e.g., Skype)
underlying
transport protocol
TCP
TCP
TCP
TCP
TCP or UDP
TCP or UDP
Application Layer
*
Application Layer
2-*
Outline
Principles of network applications
Electronic mail
SMTP, POP3, IMAP
Web and HTTP
DNS
socket programming with UDP and TCP
Application Layer
*
Application Layer
2-*
Electronic mail
Three major components:
user agents
mail servers
Simple Mail Transfer Protocol: SMTP
User Agent
composing, editing, reading mail messages
e.g., Outlook, Thunderbird, iPhone mail client
outgoing, incoming messages stored on server
user mailbox
outgoing
message queue
mail
server
mail
server
mail
server
SMTP
SMTP
SMTP
user
agent
user
agent
user
agent
user
agent
user
agent
user
agent
Application Layer
*
Application Layer
2-*
Electronic mail: mail servers
mail servers:
mailbox contains incoming messages for user
message queue of outgoing (to be sent) mail messages
SMTP protocol between mail servers to send email messages
client: sending mail server
“server”: receiving mail server
mail
server
mail
server
mail
server
SMTP
SMTP
SMTP
user
agent
user
agent
user
agent
user
agent
user
agent
user
agent
Application Layer
*
Application Layer
2-*
Electronic Mail: SMTP [RFC 2821]
uses TCP to reliably transfer email message from client to server, port 25
direct transfer: sending server to receiving server
three phases of transfer
handshaking (greeting)
transfer of messages
closure
command/response interaction (like HTTP)
commands: ASCII text
response: status code and phrase (like HTTP)
messages must be in 7-bit ASCII
Application Layer
*
Application Layer
2-*
Scenario: Alice sends message to Bob
1) Alice uses UA to compose message “to” bob@someschool.edu
2) Alice’s UA sends message to her mail server; message placed in message queue
3) client side of SMTP opens TCP connection with Bob’s mail server
4) SMTP client sends Alice’s message over the TCP connection
5) Bob’s mail server places the message in Bob’s mailbox
6) Bob invokes his user agent to read message
1
2
3
4
5
6
Alice’s mail server
Bob’s mail server
user
agent
mail
server
mail
server
user
agent
Application Layer
*
Application Layer
2-*
Sample SMTP interaction
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you
C: MAIL FROM:
S: 250 alice@crepes.fr… Sender ok
C: RCPT TO:
S: 250 bob@hamburger.edu … Recipient ok
C: DATA
S: 354 Enter mail, end with “.” on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection
Application Layer
*
Application Layer
2-*
Try SMTP interaction for yourself:
telnet servername 25
smtp.sussex.ac.uk
see 220 reply from server
enter HELO, MAIL FROM, RCPT TO, DATA, QUIT commands
above lets you send email without using email client
Application Layer
*
Application Layer
2-*
Mail message format
SMTP: protocol for exchanging email msgs
RFC 5322: standard for text message format:
header lines, e.g.,
To:
From:
Subject:
different from SMTP MAIL FROM, RCPT TO: commands!
Body: the “message”
ASCII characters only
header
body
blank
line
Application Layer
*
Application Layer
2-*
Mail access protocols
SMTP: delivery/storage to receiver’s server
Recipients could run SMTP servers but …
mail access protocol: retrieval from server
POP: Post Office Protocol [RFC 1939]: authorization, download
IMAP: Internet Mail Access Protocol [RFC 1730]: more features, including manipulation of stored msgs on server
HTTP: gmail, Hotmail, Yahoo! Mail, etc.
SMTP
SMTP
mail access
protocol
receiver’s mail
server
(e.g., POP,
IMAP)
sender’s mail
server
user
agent
user
agent
Application Layer
*
Application Layer
2-*
POP3 protocol
authorization phase
client commands:
user: declare username
pass: password
server responses
+OK
-ERR
transaction phase, client:
list: list message numbers
retr: retrieve message by number
dele: delete
quit
C: list
S: 1 498
S: 2 912
S: .
C: retr 1
S:
S: .
C: dele 1
C: retr 2
S:
S: .
C: dele 2
C: quit
S: +OK POP3 server signing off
S: +OK POP3 server ready
C: user bob
S: +OK
C: pass hungry
S: +OK user successfully logged on
Application Layer
*
Application Layer
2-*
POP3 (more)
more about POP3
previous example uses POP3 “download and delete” mode
Bob cannot re-read e-mail if he changes client
POP3 “download-and-keep”: copies of messages on different clients
POP3 is stateless across sessions (keeps state throughout a session– messages marked for deletion)
Application Layer
*
IMAP
Application Layer
2-*
for nomadic users (i.e. all of us in 201X) – complex protocol
keeps all messages in one place: at server
allows user to organize messages in folders (at server)
keeps user state across sessions:
names of folders and mappings between message IDs and folder name
users can get parts of a multi-part message
low-bandwidth or expensive connectivity
Application Layer
e-mail over HTTP
Application Layer
2-*
user agent = browser
accessing email becomes a Web Application running on top of HTTP
sending/pushing an email to the user’s SMTP server is also done through HTTP (instead of SMTP)
server-to-server communication as usual
Application Layer
Multipurpose Internet Mail Extensions (MIME)
an Internet standard that extends the format of email to support…
text in character sets other than ASCII
non-text attachments: audio, video, images, application programs
Message bodies with multiple parts
all human-written Internet email is transmitted via SMTP in MIME format
MIME designed for SMTP but extensively used in HTTP
Content-Type
text/plain, multipart/mixed, image/jpeg, audio/mp3, video/mp4, and application/msword
http://www.freeformatter.com/mime-types-list.html
Application Layer
2-*
Application Layer
Application Layer
2-*
Summary
application architectures
client-server
P2P
application service requirements:
reliability, bandwidth, delay
Internet transport service model
connection-oriented, reliable: TCP
unreliable, datagrams: UDP
SMTP, POP, IMAP
Application Layer