The TCP/IP Stack and Protocols

A-Level Computer Science · Networks

The layered network model

Network communication is organised into layers, each with a specific job. A layer only interacts with the layers directly above and below it, so any layer can be changed without affecting the others (abstraction and easier development). The TCP/IP model has four layers.

The four layers

LayerJobExample protocols
ApplicationProvides network services to programs; formats dataHTTP(S), FTP, SMTP, IMAP, POP3, DNS
TransportSplits data into packets/segments, adds port numbers, manages reliability and reassemblyTCP, UDP
Internet (Network)Adds IP addresses; routes packets across networksIP
Link (Network access)Physical transmission over the hardware; adds MAC addressesEthernet, Wi-Fi

Data passes down the layers at the sender (each adds its own header — encapsulation) and back up at the receiver (each strips its header).

TCP vs UDP

  • TCP (Transmission Control Protocol): connection-oriented and reliable — numbers packets, checks for errors, resends lost packets, reassembles in order. Used for web, email, file transfer.
  • UDP (User Datagram Protocol): connectionless and faster but unreliable — no guarantee of delivery or order. Used for streaming, gaming, VoIP where speed matters more than perfection.

Ports and sockets

  • A port number identifies which application/service a packet is for (e.g. HTTP = 80, HTTPS = 443, FTP = 21, SMTP = 25).
  • A socket = an IP address + a port number, uniquely identifying an endpoint of a connection.

IP addresses and DNS

  • An IP address identifies a device on a network (IPv4 = 32-bit, e.g. 192.168.0.1; IPv6 = 128-bit for far more addresses).
  • DNS (Domain Name System) translates human-readable domain names (e.g. example.com) into IP addresses via a hierarchy of DNS servers.
  • A MAC address is a unique physical hardware address of a network card (used at the link layer).

Worked example

Which layer adds the IP address, and which adds port numbers?

  • The Internet layer adds IP addresses (for routing between networks); the Transport layer (TCP) adds port numbers (to reach the right application). ✓

Common mistakes

  • Confusing IP addresses (Internet layer, logical) with MAC addresses (Link layer, physical).
  • Saying UDP is reliable — TCP is reliable; UDP trades reliability for speed.
  • Mixing up which protocols sit at which layer.

Exam tips

  • Learn the four layers in order with their jobs and example protocols.
  • Contrast TCP (reliable, ordered) vs UDP (fast, connectionless) with a use for each.
  • Know what a socket, port, IP address, MAC address and DNS each do.

Key facts to remember

  • TCP/IP layers: Application, Transport, Internet, Link — each adds/strips a header (encapsulation).
  • TCP = reliable/ordered; UDP = fast/connectionless; ports identify the application, sockets = IP + port.
  • IP address = logical device address; MAC = physical; DNS maps domain names → IP addresses.
Don't understand a part?

Sign in and ask our AI tutor to explain any passage in plain English.

Try AI explanations →

← All A-Level Computer Science notes