Email, content delivery, and other applications
Beyond the web, the application layer includes email's store-and-forward system, content delivery networks that bring data close to users, and peer-to-peer distribution.
How email works
Email involves user agents (mail programs and webmail), mail servers holding mailboxes, and the Simple Mail Transfer Protocol (SMTP), defined in 1982. The sender's user agent submits mail to its own mail server; that server looks up the recipient domain's MX record and delivers the message over SMTP to the recipient's mail server, which stores it until the recipient reads it.
Retrieving and formatting mail
SMTP pushes mail between servers; users retrieve mail using IMAP, which keeps messages on the server and synchronises folders across devices, or the older POP3, or through webmail over HTTPS. Messages have headers such as From, To, Subject, and Date, and MIME extensions allow attachments, non-English text, and HTML content.
Email authentication and spam
SMTP originally let anyone claim any sender address, which spammers and phishers exploit. SPF publishes which servers may send for a domain, DKIM adds a digital signature to messages, and DMARC tells receivers what to do when checks fail; all three use DNS TXT records. Major mailbox providers increasingly require them from bulk senders.
Video streaming
Video is the largest share of internet traffic. Streaming services encode each video at several bit rates and split it into short chunks, a few seconds each. With dynamic adaptive streaming over HTTP (DASH) or Apple's HLS, the player measures available throughput and picks the best quality chunk it can download in time, switching up or down as conditions change.
Content delivery networks
A content delivery network (CDN) stores copies of content on servers in many locations, close to users. DNS or anycast directs each request to a nearby, lightly loaded server, reducing latency and backbone traffic. Some CDNs place servers deep inside access ISPs; others use fewer, larger sites at IXPs. Akamai, Cloudflare, and the private CDNs of Netflix and Google are major examples.
Peer-to-peer file distribution
Distributing a large file to N users from one server takes time growing with N. In P2P distribution, each peer uploads pieces to others, adding capacity. In BitTorrent, a file is split into chunks; peers download rare chunks first and upload to peers that upload to them (tit-for-tat), so a swarm can distribute a file far faster than a single server could.
Other application protocols
SSH provides secure remote login and file transfer; FTP is an older file transfer protocol; WebSockets keep a full-duplex connection open for chat and live updates; WebRTC enables browser-to-browser audio and video calls; and many services expose REST or gRPC APIs over HTTP. Each defines its own message formats and rules atop TCP, UDP, or QUIC.
Worked example
Alice at alice@schoolmail.example sends to bob@townmail.example. Her app submits the message to smtp.schoolmail.example. That server queries DNS for townmail.example's MX record, opens an SMTP connection to mx.townmail.example, and transfers the message. Bob's server checks SPF, DKIM, and DMARC, then stores it. Bob's phone, connected via IMAP, sees the new message and downloads it.
Key takeaways
Email uses user agents, mail servers, and SMTP (1982), with MX records directing delivery; users retrieve mail by IMAP, POP3, or webmail, and MIME handles attachments and formatting. SPF, DKIM, and DMARC authenticate senders using DNS. Streaming splits video into chunks at multiple bit rates, with DASH or HLS adapting quality to throughput. CDNs serve content from nearby servers using DNS or anycast. BitTorrent distributes files peer to peer with rarest-first and tit-for-tat. SSH, WebSockets, WebRTC, and APIs are other application protocols.
Flashcard
Simple Mail Transfer Protocol
Check your understanding
During a video stream, the viewer's throughput drops. What does a DASH player typically do?
