Chapter 2
Application Layer
Computer Networking: A
Top-Down Approach
8th edition n
Jim Kurose, Keith Ross
Pearson, 2020
Application Layer: 2-1
Lecture outline:
HTTP/2
HTTP/2 to HTTP3
HOL
Email
Mail servers
SMTP
Mail message format Computer Networking: A
Top-Down Approach
8th edition n
Jim Kurose, Keith Ross
Pearson, 2020
Application Layer: 2-2
HTTP/2
Key goal: decreased delay in multi-object HTTP requests
HTTP1.1: introduced multiple, pipelined GETs over single TCP
connection
server responds in-order (FCFS: first-come-first-served scheduling) to
GET requests
with FCFS, small object may have to wait for transmission (head-of-
line (HOL) blocking) behind large object(s)
loss recovery (retransmitting lost TCP segments) stalls object
transmission
Application Layer: 2-3
HTTP/2
Key goal: decreased delay in multi-object HTTP requests
HTTP/2: [RFC 7540, 2015] increased flexibility at server in sending
objects to client:
methods, status codes, most header fields unchanged from HTTP 1.1
transmission order of requested objects based on client-specified
object priority (not necessarily FCFS)
push unrequested objects to client
divide objects into frames, schedule frames to mitigate HOL blocking
Application Layer: 2-4
HTTP/2: mitigating Head of line HOL blocking
HTTP 1.1: client requests 1 large object (e.g., video file) and 3 smaller
objects
server
GET O4 GET O3 GET O2 GET O1 object data requested
client
O1
O2
O1 O3
O2
O3
O4
O4
objects delivered in order requested: O2, O3, O4 wait behind O1 Application Layer: 2-5
HTTP/2: mitigating HOL blocking
HTTP/2: objects divided into frames, frame transmission interleaved
server
GET O4 GET O3 GET O2 GET O1 object data requested
client
O2
O4
O3 O1
O2
O3
O1
O4
O2, O3, O4 delivered quickly, O1 slightly delayed
Application Layer: 2-6
HTTP/2 to HTTP/3
HTTP/2 over single TCP connection means:
recovery from packet loss still stalls all object transmissions
• as in HTTP 1.1, browsers have incentive to open multiple parallel
TCP connections to reduce stalling, increase overall throughput
HTTP/3: adds security, per object error- and congestion-
control (more pipelining) over UDP
• more on HTTP/3 in transport layer
Application Layer: 2-7
Application layer: overview
P2P applications
Principles of network video streaming and content
applications distribution networks
Web and HTTP socket programming with
E-mail, SMTP, IMAP UDP and TCP
The Domain Name System
DNS
Application Layer: 2-8
E-mail user
agent
Three major components: mail user
user agents server agent
mail servers SMTP mail user
agent
simple mail transfer protocol: SMTP SMTP
server
SMTP user
User Agent mail agent
a.k.a. “mail reader” server
user
composing, editing, reading mail messages agent
user
e.g., Outlook, iPhone mail client agent
outgoing
outgoing, incoming messages stored on message queue
server user mailbox
Application Layer: 2-9
E-mail: mail servers user
agent
mail servers: mail user
server
mailbox contains incoming agent
messages for user SMTP mail user
server agent
message queue of outgoing (to be SMTP
sent) mail messages user
SMTP agent
SMTP protocol between mail mail
server
servers to send email messages user
agent
client: sending mail server user
“server”: receiving mail server agent
outgoing
message queue
user mailbox
Application Layer: 2-10
SMTP RFC (5321) “client”
SMTP server
“server”
SMTP server
Operates on the top of TCP, uses TCP to
reliably transfer email message from client initiate TCP
(mail server initiating connection) to server, connection
port 25 RTT
TCP connection
direct transfer: sending server (acting like client) initiated
to receiving server. It will not transfer file to
intermediate server. 220
three phases of transfer SMTP
handshaking
HELO
• SMTP handshaking (greeting) 250 Hello
• SMTP transfer of messages (transfer of data)
• SMTP closure (quit email server) SMTP
command/response interaction (like HTTP) transfers
• commands: ASCII text time
• response: status code and phrase Application Layer: 2-11
Scenario: Alice sends e-mail to Bob
1) Alice uses UA to compose e-mail 4) SMTP client sends Alice’s message
message “to” bob@[Link] over the TCP connection
2) Alice’s UA sends message to her 5) Bob’s mail server places
mail server using SMTP; message the message in Bob’s
placed in message queue mailbox
3) client side of SMTP at mail server 6) Bob invokes his user
opens TCP connection with Bob’s mail agent to read message
server
1 user mail user
mail agent
agent server server
2 3 6
4
5
Alice’s mail server Bob’s mail server
Application Layer: 2-12
Sample SMTP interaction
S: 220 [Link]
C: HELO [Link]
S: 250 Hello [Link], pleased to meet you
C: MAIL FROM: <alice@[Link]>
S: 250 alice@[Link]... Sender ok
C: RCPT TO: <bob@[Link]>
S: 250 bob@[Link] ... 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 [Link] closing connection
Application Layer: 2-13
SMTP: observations
comparison with HTTP:
SMTP uses persistent
HTTP: client pull (when a protocol download/receives connections
data according to its convenience. Nothing is imposed. No
restriction. SMTP requires message
SMTP: client push (Receiving data is not user (header & body) to be in
dependent. When data is there, it will be pushed towards 7-bit ASCII
receiving mail server so that it receives data.)
SMTP server uses
both have ASCII command/response [Link] to determine
interaction, status codes end of message
HTTP: each object encapsulated in its
own response message
SMTP: multiple objects sent in
multipart message Application Layer: 2-14
Mail message format
SMTP: protocol for exchanging e-mail messages, defined in RFC 5321
(like RFC 7231 defines HTTP)
RFC 2822 defines syntax for e-mail message itself (like HTML defines
syntax for web documents)
header lines, e.g., header
blank
• To: line
• From:
• Subject:
these lines, within the body of the email body
message area different from SMTP MAIL FROM:,
RCPT TO: commands!
Body: the “message” , ASCII characters only
Application Layer: 2-15
Retrieving email: mail access protocols
user
e-mail access user
SMTP SMTP protocol
agent agent
(e.g., IMAP,
HTTP)
sender’s e-mail receiver’s e-mail
server server
SMTP: delivery/storage of e-mail messages to receiver’s server. Pull protocol cannot
work at receiver end because receiver will check email according to their convenience.
mail access protocol: retrieval from server
• IMAP: Internet Mail Access Protocol [RFC 3501]: messages stored on server, IMAP
provides retrieval, deletion, folders of stored messages on server
HTTP: gmail, Hotmail, Yahoo!Mail, etc. provides web-based interface on
top of STMP (to send), IMAP (or POP) to retrieve e-mail messages
Application Layer: 2-16
Application Layer: Overview
P2P applications
Principles of network video streaming and content
applications distribution networks
Web and HTTP socket programming with
E-mail, SMTP, IMAP UDP and TCP
The Domain Name System
DNS
Application Layer: 2-17
DNS: Domain Name System
people: many identifiers: Domain Name System (DNS):
• SSN, name, passport # distributed database implemented in
Internet hosts, routers: hierarchy of many name servers
• IP address (32 bit) - used for application-layer protocol: hosts, DNS
addressing datagrams servers communicate to resolve
• “name”, e.g., [Link] - names (address/name translation)
used by humans
• note: core Internet function,
Q: how to map between IP implemented as application-layer
address and name, and vice protocol
versa ?
• complexity at network’s “edge”
Application Layer: 2-18
That’s all!
Application Layer: 2-19