Quiz 2
Registry Synced

Application Layer Protocols

641 words
3 min read

Reading compass

Now · 🎯 Learning Objectives

Application Layer Protocols

🎯 Learning Objectives

  • Explain HTTP request/response cycle and methods
  • Trace DNS resolution from browser to root server
  • Understand email delivery via SMTP, POP3, IMAP
  • Compare HTTP/1.1, HTTP/2, and HTTP/3
  • Analyze protocol message formats

1. HTTP Protocol

1.1 Request-Response Cycle

(Diagram)

1.2 HTTP Methods

MethodPurposeSafe?Idempotent?
GETRetrieve resourceYesYes
HEADGet headers onlyYesYes
POSTSubmit dataNoNo
PUTReplace resourceNoYes
DELETERemove resourceNoYes
PATCHPartial updateNoNo

1.3 Status Codes

CodeMeaningExample
1xxInformational101 Switching Protocols
2xxSuccess200 OK, 201 Created
3xxRedirection301 Moved, 304 Not Modified
4xxClient Error404 Not Found, 403 Forbidden
5xxServer Error500 Internal Error, 503 Unavailable

1.4 HTTP Versions

VersionYearFeatures
HTTP/1.01996Basic, one request per TCP
HTTP/1.11997Persistent connections, pipelining
HTTP/22015Multiplexing, header compression, server push
HTTP/32022QUIC (UDP-based), no head-of-line blocking

2. DNS (Domain Name System)

2.1 Hierarchy

(Diagram)

2.2 Resolution Steps

StepServerQueryResponse
1Local cachewww.example.com?Miss
2Recursive resolverwww.example.com?
3Root server.com nameserver?a.gtld-servers.net
4TLD serverexample.com nameserver?ns1.example.com
5Authoritativewww.example.com?93.184.216.34
6Local resolverCache: 93.184.216.34

2.3 Record Types

TypePurposeExample
AIPv4 addressexample.com → 93.184.216.34
AAAAIPv6 addressexample.com → 2606:2800:220:1:...
CNAMECanonical name (alias)www → example.com
MXMail server@example.com → mail.example.com
NSNameserverexample.com → ns1.example.com
TXTArbitrary textSPF, DKIM verification
SOAStart of AuthorityZone transfer info

3. Email: SMTP, POP3, IMAP

3.1 SMTP Delivery

(Diagram)

3.2 Full Email Flow

  1. Alice composes email → MUASender (User Agent)
  2. MUA sends to MTA (Message Transfer Agent) via SMTP (port 25/587)
  3. MTA queries DNS for MX record of recipient domain
  4. MTA relays to recipient's MTA via SMTP
  5. Recipient MTA stores in mailbox
  6. Bob retrieves via POP3 (download) or IMAP (sync)

3.3 POP3 vs IMAP

FeaturePOP3IMAP
Port110 (SSL: 995)143 (SSL: 993)
StorageLocalServer
Multiple devicesNoYes
Server foldersNoYes
Offline accessYes (downloaded)Optional

4. FTP (File Transfer Protocol)

ModeDescription
ActiveClient: random port → server:21 (control). Server:20 → client:random (data)
PassiveClient: random → server:21 (control). Client: random → server:random (data)
Passive mode works through firewalls (client initiates both connections).

5. Common Pitfalls

Pitfall: Confusing DNS Caching Levels

The mistake: Not understanding that changes to DNS records take time to propagate. Correct approach: Browser (seconds-minutes), OS (minutes), resolver (hours-days), TLD cache (days). TTL values determine caching duration. Lower TTL for planned changes.

6. Key Concepts Reference

ProtocolPortTransportUse Case
HTTP80TCPWeb browsing
HTTPS443TCP/TLSSecure web
DNS53UDP/TCPName resolution
SMTP25/587TCPEmail sending
POP3110TCPEmail receiving
IMAP143TCPEmail sync
FTP20/21TCPFile transfer
SSH22TCPSecure shell

7. 📝 Practice Questions

Q1: Trace DNS resolution for www.iitm.ac.in from a browser.
Answer:
  1. Browser checks local DNS cache
  2. OS checks resolver cache (usually your ISP or 8.8.8.8)
  3. Resolver queries root server → .in TLD server
  4. .in TLD → ac.in nameserver
  5. ac.in → iitm.ac.in authoritative nameserver
  6. iitm.ac.in returns 103.xxx.xxx.xxx (A record)
  7. Cache the result (respecting TTL) Q2: A POST request returned 301. What happened?
Answer: 301 Moved Permanently means the resource URL changed. Browser should follow the Location header redirect. For POST, browser typically converts to GET for the redirected request (unless 307/308 status). This is a common issue with API design. Q3: Why does HTTP/3 use UDP instead of TCP?
Answer: HTTP/3 runs over QUIC, which uses UDP. Benefits: (1) Zero round-trip connection establishment (vs. TCP's 3-way handshake + TLS). (2) No head-of-line blocking (one lost packet doesn't block all streams). (3) Connection migration (survives IP address changes). (4) Built-in encryption. QUIC is a transport protocol implemented in userspace, allowing faster deployment. Q4: Calculate time to resolve a DNS query with 4 levels of recursion, each taking 50ms RTT.
Answer: Total = 4 × 50ms = 200ms for the first query. Subsequent queries are cached: browser cache (instant if cached), OS cache (~ms), resolver cache (instant). First query is slow; subsequent queries are fast due to negative caching too.

8. 🔗 Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.