Skip to topic
    ← Back to course topics

    TCP/IP — AQA A-Level Computer Science

    The TCP/IP stack is a modular four-layer communication protocol suite (Application, Transport, Network, Link) governing data transmission across networks. It standardises packet encapsulation, end-to-end addressing, logical routing, and error checking to ensure reliable cross-platform interoperability.

    TCP/IP explained

    The TCP/IP stack organises network communication into four layers, each with a distinct job.

    Read the full explanation

    The application layer holds the protocols that user programs use directly, such as HTTP for web pages, SMTP for email and FTP for file transfer. The transport layer, using TCP or UDP, moves data between two applications on different hosts, adding port numbers so the correct program receives each message; TCP adds reliability through acknowledgements and retransmission. The network layer, using IP, addresses hosts and routes packets across interconnected networks from source to destination. The link layer carries packets across a single physical connection or local network segment, handling framing and addressing within that segment, for example through Ethernet or Wi-Fi.

    Your focus

    1. Describe the role of the four layers of the TCP/IP stack (application, transport, network, link).

    Which command word is this?

    Set out the mathematical or logical reasons for how something happens. You must link cause to effect rather than simply defining terms.

    TCP/IP exam tips

    Topic Overview

    The TCP/IP stack is the fundamental communication framework that underpins the global internet and modern computer networks. It provides an abstract, modular architecture consisting of four discrete layers (Application, Transport, Network, and Link), each tasked with specific communication protocols and boundaries.

    Understanding TCP/IP is essential for AQA A-Level Computer Science, as it connects theoretical data structures to physical transmission systems. Mastery of this model equips students to analyse network vulnerabilities, routing behaviours, data integrity mechanisms, and socket-level programming interfaces.

    Key Concepts
    • →Four-Layer Model: Application (protocols like HTTP, FTP, SMTP, DNS), Transport (TCP, UDP), Network/Internet (IP), and Link/Network Interface (Ethernet, Wi-Fi).
    • →Encapsulation and Decapsulation: Wrapping higher-layer PDUs with layer-specific headers (and Link trailers) during transmission and stripping them sequentially upon receipt.
    • →Sockets and Port Numbers: Combining an IP address with a 16-bit port number to establish a unique identifier for a specific communicating application process.
    • →Packet Switching: Dividing data into independent packets tagged with IP addresses and sequence numbers to allow dynamic path selection through routers.
    • →Transmission Control: TCP uses a three-way handshake (SYN, SYN-ACK, ACK), checksums, windowing, and timeouts to guarantee ordered and lossless data delivery.
    Marking Points
    • Identifies the application layer as the layer that provides protocols used directly by user programs
    • Identifies the transport layer as responsible for end-to-end delivery between applications using ports
    • Identifies the network layer as responsible for logical addressing and routing packets across networks
    • Identifies the link layer as responsible for transferring frames across a single physical link or local network
    Examiner Tips
    • 💡Use the layer names exactly as given in the specification when labelling a diagram or answering an MCQ
    • 💡Link each layer to one key example protocol to make recall faster, such as HTTP, TCP, IP and Ethernet
    • 💡When a question gives a function, ask which layer owns it: addressing across networks points to IP, while delivery between applications points to TCP or UDP
    • 💡Memorise standard port numbers specified by AQA: 20/21 (FTP), 22 (SSH), 25 (SMTP), 53 (DNS), 80 (HTTP), and 443 (HTTPS). Questions frequently award a mark for matching a protocol to its default port.
    • 💡In 6-mark or 9-mark extended answers about data movement, always list the layers in strict order (top-to-bottom or bottom-to-top) and name the protocol data unit at each stage: Data, Segment, Packet, Frame, Bits.
    • 💡Distinguish clearly between routing and forwarding: Routing determines the optimal end-to-end path across networks using algorithms, while forwarding moves a packet from an input interface to an output interface within a single router.
    Common Mistakes
    • Assigns routing to the transport layer; route packets across networks at the network layer using IP addresses
    • Confuses port numbers with IP addresses; ports identify applications at the transport layer, while IP addresses identify hosts at the network layer
    • Places the physical transmission of bits in the network layer; the link layer, together with the hardware it controls, handles transfer over the physical link
    • Assuming routers read and alter Application or Transport layer data: Standard routers operate strictly up to the Network layer (Layer 3) to inspect IP headers for routing; they do not process port numbers or application payloads.
    • Believing MAC addresses travel across the entire internet: A destination MAC address changes at every router hop on the path, whereas the destination IP address remains constant from source to destination.
    • Confusing TCP and IP roles: Students often state that IP guarantees delivery; IP is entirely best-effort and connectionless, while TCP handles error detection, sequencing, and reliable delivery.
    Revision Plan
    1. 1Day 1-2: Map out the 4-layer TCP/IP stack on flashcards, listing the purpose, protocols, and data structures (segments, packets, frames) for each layer.
    2. 2Day 3-4: Practise socket addressing, mapping default port numbers to protocols, and tracing how packets cross subnets via default gateways.
    3. 3Day 5-6: Diagram the encapsulation/decapsulation pipeline and compare TCP against UDP using past paper scenario-based questions.
    4. 4Day 7: Complete timed AQA past-paper questions focusing on 6-mark protocol comparison and packet-switching analysis.
    Exam Question Types
    • 📋Layer identification and role description: Short 2-3 mark questions asking to name which layer performs a specific task (e.g., error detection or port addressing).
    • 📋Extended comparison response: 4-6 mark questions contrasting TCP vs UDP, or circuit switching vs packet switching in given application contexts.
    • 📋Data transmission trace: Step-by-step description of an end-to-end exchange (e.g., DNS resolution followed by an HTTP GET request).
    Command Word Expectations (AQA)
    Explain

    Set out the mathematical or logical reasons for how something happens. You must link cause to effect rather than simply defining terms.

    Describe

    Provide a factual, step-by-step account of a process or system without needing to justify the underlying reasoning.

    Compare

    Identify both similarities and differences between two technologies (e.g., TCP vs UDP), making direct paired comparisons rather than writing isolated paragraphs.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Confusing the responsibilities of the Transport layer and Network layer, particularly mixing up MAC addresses, IP addresses, and port numbers.
    ❌ Weak Answer (Loses Marks):The Network layer breaks the message down into packets and adds the destination port number so it reaches the right app.
    Example improved answer:The Transport layer splits data into segments, manages end-to-end connections, and adds source and destination port numbers. The Network (Internet) layer handles logical addressing by attaching source and destination IP addresses to form packets and determines optimal routing across intermediate networks.
    Examiner Tip: Always link each layer directly to its Protocol Data Unit (PDU) and addressing scheme: Transport uses segments/ports, Network uses packets/IP addresses, and Link uses frames/MAC addresses.
    Pitfall: Vaguely describing packet switching without referencing reassembly order, routing autonomy, or checksum verification.
    ❌ Weak Answer (Loses Marks):Packet switching chops data up into packets, sends them through the internet, and puts them together at the other end.
    Example improved answer:In packet switching, data is split into individual packets, each containing payload data, sequence numbers, source/destination IP addresses, and error checksums. Packets traverse the network independently across dynamic routes via intermediate routers, and the destination host uses sequence numbers to reassemble them into the original order, requesting retransmission if checksum checks fail.
    Examiner Tip: Explicitly state that individual packets can take completely different physical routes and arrive out of sequence before being reassembled using sequence numbers.
    Step-by-Step Worked Solutions

    Question: Explain the process of encapsulation and decapsulation as an HTTP request is transmitted from a client web browser to a web server via the TCP/IP stack. [6 marks]

    1. 1.Step 1: Identify the role of the Application layer during transmission: The web browser constructs an HTTP GET request containing application-level commands and payload data.
    2. 2.Step 2: Detail Transport layer encapsulation: The request is passed to the Transport layer (TCP), where it is split into segments; a TCP header containing source/destination port numbers (destination port 80 or 443) and sequence numbers is appended.
    3. 3.Step 3: Detail Network layer encapsulation: Segments are passed to the Network/Internet layer (IP), which attaches an IP header containing source and destination IP addresses, packaging them into IP packets for routing.
    4. 4.Step 4: Detail Link layer encapsulation: The packet descends to the Link/Network Interface layer, adding a MAC header (source and next-hop physical MAC addresses) and a frame trailer/checksum to create a frame, then converts it into physical signals/bits.
    5. 5.Step 5: Explain decapsulation upon receipt: When received by the server, the Link layer checks the frame trailer, strips the MAC header, and passes the packet upwards. The Network layer validates the IP address and strips the IP header.
    6. 6.Step 6: Conclude with final delivery: The Transport layer verifies sequence numbers/checksums, strips the TCP header, reassembles segments, and directs the raw HTTP payload to the web server process listening on the specified destination port.
    Final Answer: Data moves down the client stack gaining protocol headers (encapsulation: data -> segment with ports -> packet with IPs -> frame with MACs) and moves up the server stack having headers verified and stripped (decapsulation) until raw application data reaches the target process.

    Question: Compare TCP and UDP, giving one scenario where UDP is preferred over TCP and explaining why. [4 marks]

    1. 1.Step 1: Define TCP characteristics: TCP is a connection-oriented protocol that establishes a three-way handshake, ensures reliable delivery via segment acknowledgements, and orders packets using sequence numbers.
    2. 2.Step 2: Define UDP characteristics: UDP is a connectionless, lightweight protocol with no handshake, no guarantee of delivery, and no automatic retransmission mechanism.
    3. 3.Step 3: Select an appropriate scenario: Real-time multiplayer video gaming or live VoIP streaming.
    4. 4.Step 4: Justify the choice: In real-time video or audio streaming, low latency is critical; retransmitting a dropped packet causes buffering delays, and a lost video frame is obsolete by the time it arrives, making UDP high throughput and low overhead preferable.
    Final Answer: TCP guarantees reliable, ordered packet delivery using acknowledgements and sequence numbers at the cost of overhead. UDP offers lightweight, connectionless transmission without delivery guarantees. UDP is preferred in live VoIP/video streaming because immediate delivery takes priority over absolute data integrity.
    Active Recall Memory Test
    Name the four layers of the TCP/IP stack from highest to lowest abstraction.
    Key Fact: Application Layer, Transport Layer, Network (Internet) Layer, Link (Network Interface) Layer.
    What three packets constitute the TCP connection establishment handshake?
    Key Fact: SYN (Synchronize), SYN-ACK (Synchronize-Acknowledge), and ACK (Acknowledge).
    What constitutes a network socket?
    Key Fact: An IP address concatenated with a port number (e.g., 192.168.1.10:80).
    Which layer handles MAC addressing and physical frame delivery between adjacent nodes?
    Key Fact: The Link (or Network Interface) layer.
    Frequently Asked Questions
    What is the difference between the TCP/IP model and the OSI model?
    The TCP/IP model is a practical 4-layer architectural standard implemented in real-world networking, whereas the OSI model is a 7-layer theoretical conceptual model. The Application layer in TCP/IP encompasses the OSI Application, Presentation, and Session layers. AQA A-Level Computer Science focuses predominantly on the 4-layer TCP/IP suite.
    Why does DNS use UDP instead of TCP for standard lookups?
    DNS lookups consist of a single request and a single response packet, making the overhead of establishing a TCP three-way handshake unnecessary. UDP provides fast, lightweight transmission with low latency. If a DNS response packet is dropped, the client application simply times out and re-queries.
    How does a router determine where to send an incoming IP packet?
    A router extracts the destination IP address from the packet header and applies its subnet mask. It consults its internal routing table to locate the best matching prefix, identifying the next-hop IP address and the corresponding outgoing physical interface. It then re-encapsulates the packet into a new Link-layer frame addressed to the next router MAC address.
    What is the difference between a private IP address and a public IP address?
    Private IP addresses (e.g., 192.168.x.x, 10.x.x.x) are reserved for use within local area networks and cannot be routed across the public internet. Public IP addresses are globally unique and routable across internet backbones. Network Address Translation (NAT) running on a gateway router translates private addresses to a single shared public IP.
    What happens if a TCP segment is lost during internet transmission?
    TCP tracks transmitted segments using sequence numbers and expects an acknowledgement (ACK) from the receiving host. If the sending host does not receive an ACK before a retransmission timer expires, it assumes the segment was lost or corrupted and retransmits that specific segment automatically.