Show understanding of protocols (HTTP, FTP, POP3, IMAP, SMTP, BitTorrent) and their purposes

Published by Patrick Mutisya · 14 days ago

Cambridge A-Level Computer Science 9618 – Protocols (Topic 14.1)

14.1 Protocols

This section explains the most common application‑layer protocols used on the Internet, their purposes, typical ports and the type of communication they employ.

Key Protocols

  • HTTP – HyperText Transfer Protocol
  • FTP – File Transfer Protocol
  • POP3 – Post Office Protocol version 3
  • IMAP – Internet Message Access Protocol
  • SMTP – Simple Mail Transfer Protocol
  • BitTorrent – Peer‑to‑Peer file‑sharing protocol

Protocol Summary Table

ProtocolPurposeTypical Port(s)Communication ModelConnection Type
HTTPTransfer hypertext documents and other resources (web pages, images, JSON, etc.)80 (plain), 443 (HTTPS)Client‑ServerStateless request/response over TCP
FTPUpload and download files between client and server21 (control), 20 (data – active mode) or random high ports (passive mode)Client‑ServerStateful session over TCP
POP3Retrieve email from a mail server and optionally delete it110 (plain), 995 (POP3S)Client‑ServerStateless after each download; uses TCP
IMAPAccess and manipulate email stored on a server without removing it143 (plain), 993 (IMAPS)Client‑ServerStateful session over TCP
SMTPSend email from client to mail server and between mail servers25 (plain), 587 (submission), 465 (SMTPS)Client‑ServerStateless transaction over TCP
BitTorrentDistribute large files efficiently using a peer‑to‑peer network6881‑6889 (default), can use any high portPeer‑to‑Peer (swarm)Stateful connections over TCP (and optional UDP for DHT)

HTTP – HyperText Transfer Protocol

HTTP is the foundation of data communication for the World Wide Web. It follows a request/response model where a client (usually a web browser) sends a request line, headers and optionally a body, and the server replies with a status line, headers and a body containing the requested resource.

Typical request methods include GET, POST, PUT, DELETE, and HEAD. The response status codes are grouped into categories: \$1xx\$ (informational), \$2xx\$ (success), \$3xx\$ (redirection), \$4xx\$ (client error), \$5xx\$ (server error).

Suggested diagram: Client‑Server interaction for an HTTP GET request.

FTP – File Transfer Protocol

FTP provides a reliable way to transfer files between a client and a server. It uses two separate TCP connections:

  1. Control connection on port 21 – carries commands and responses.
  2. Data connection – either active (server connects from port 20) or passive (client connects to a server‑chosen high port).

Common commands include USER, PASS, LIST, RETR, STOR, and QUIT.

POP3 – Post Office Protocol version 3

POP3 is a simple protocol for retrieving email from a mail server. The typical workflow is:

  1. Client connects to the server and authenticates.
  2. Client issues LIST to see available messages.
  3. Client uses RETR n to download message n.
  4. Optionally, client sends DELE n to delete the message from the server.
  5. Client ends the session with QUIT.

Because POP3 usually removes messages after download, it is best suited for single‑device access.

IMAP – Internet Message Access Protocol

IMAP allows clients to manage email directly on the server, supporting multiple folders, message flags, and simultaneous access from several devices. Key commands include SELECT, FETCH, SEARCH, STORE, and EXPUNGE. Unlike POP3, messages remain on the server unless explicitly deleted.

SMTP – Simple Mail Transfer Protocol

SMTP is used for sending mail. The typical path of an email is:

  1. Mail client (MUA) submits the message to an outgoing server (submission) using SMTP on port 587 (or 465 for implicit TLS).
  2. The submission server forwards the message to the recipient’s mail exchanger (MX) using SMTP on port 25.
  3. The recipient’s server stores the message, where it can be retrieved via POP3 or IMAP.

SMTP commands include HELO/EHLO, MAIL FROM, RCPT TO, DATA, and QUIT.

BitTorrent – Peer‑to‑Peer File Sharing

BitTorrent distributes large files by breaking them into small pieces and sharing those pieces among many peers. The process involves:

  1. A tracker that maintains a list of peers for a particular torrent.
  2. Peers that act as both downloaders and uploaders (seeders and leechers).
  3. Each peer requests missing pieces from multiple other peers simultaneously, increasing overall throughput.

The protocol uses a swarm model, where the overall download speed improves as more peers join and share pieces.

Suggested diagram: BitTorrent swarm showing peers exchanging file pieces.

Comparative Overview

All the protocols above operate at the application layer of the OSI/TCP‑IP model, but they differ in purpose, communication pattern and state management. The table below highlights the main contrasts.

AspectHTTPFTPPOP3IMAPSMTPBitTorrent
Primary UseWeb page and resource retrievalFile upload/downloadDownload email (delete after)Manage email on serverSend emailDistribute large files
ModelClient‑ServerClient‑ServerClient‑ServerClient‑ServerClient‑Server (relay)Peer‑to‑Peer (swarm)
StatefulnessStateless per requestStateful sessionStateless after each downloadStateful sessionStateless transactionStateful connections
Typical Port(s)80 / 44321 / 20 (active) or high ports (passive)110 / 995143 / 99325 / 587 / 4656881‑6889 (default)

Key Take‑aways

  • Protocols define the rules for communication between devices.
  • HTTP, FTP, POP3, IMAP and SMTP are classic client‑server protocols that rely on TCP for reliable delivery.
  • BitTorrent exemplifies a modern peer‑to‑peer protocol that improves scalability for large data distribution.
  • Understanding ports, connection models and state management helps in troubleshooting and designing networked applications.