AS & A Level Computer Science · Area 2 · A Level content

Protocols, circuit switching and packet switching

Protocols are the agreed rules that let two computers exchange data, and in TCP/IP they are arranged in four layers, each with its own job. This page covers why protocols matter, what each TCP/IP layer does, the purpose of HTTP, FTP, SMTP, POP3, IMAP and BitTorrent, and how circuit switching and packet switching move data in different ways. You lose marks by naming a layer or a protocol without saying what it does, by confusing SMTP with POP3 or IMAP, and by writing that a router forwards a packet straight to its destination.

Not started

Syllabus coverage

  • Why a protocol is essential for communication between computers
  • How protocol implementation can be viewed as a stack, where each layer has its own functionality
  • The TCP/IP protocol suite as four layers: Application, Transport, Internet, Link
  • The purpose and function of the Application layer, including the protocols it contains
  • The purpose and function of the Transport layer: splitting data into packets, sequence numbers, acknowledgements and retransmission
  • The purpose and function of the Internet layer: source and destination IP addresses, and routing between networks
  • The purpose and function of the Link layer: frames, MAC addresses and transmission over the physical medium
  • The purpose of HTTP and FTP
  • The purpose of POP3, IMAP and SMTP when a message is sent from one host to another on the internet
  • The purpose of BitTorrent: peer-to-peer file sharing
  • Circuit switching: how a dedicated path is set up, used and released, with benefits, drawbacks and where it is applicable
  • Packet switching: benefits, drawbacks and where it is applicable
  • The function of a router in packet switching
  • How packet switching is used to pass messages across a network, including the internet

Part of the AS & A Level Computer Science syllabus 9618.

Why a protocol is essential

A protocol is a set of rules that governs how two devices exchange data. It is not the data itself and it is not the cable: it is the agreement about how the data will be structured, addressed, transmitted and checked. Both the sender and the receiver must implement the same protocol, and both must follow it, or the message that arrives cannot be interpreted.

Without that agreement a receiving device is handed a stream of bits with no way of knowing where one message ends and the next begins, which part is the address of the sender, whether the payload is text or a compressed image, or whether the whole thing arrived intact. Multiply that by the number of different manufacturers, operating systems and network technologies on the internet and the problem becomes obvious: a browser on a phone can fetch a page from a server on another continent only because both ends use HTTP in exactly the same way.

Every protocol settles three things. The format (syntax) covers the structure of the data and of the addresses, including how the start and end of a message are marked. The meaning and order (semantics) covers what each field means and the sequence of requests and replies. Timing (synchronisation) covers how fast data may be sent, how long to wait for a reply, and what to do when a reply does not arrive.

Protocols also agree how a connection is opened and closed, how errors are detected and corrected, and how a fast sender is stopped from overwhelming a slow receiver (flow control). Two computers that agree on the format but not on error handling will still fail as soon as a packet is corrupted.

The agreement has to cover small details as well as large ones. A line break is represented differently on different systems, an image may be compressed with one of several algorithms, and a message may be split across several packets. Each of those choices has to be fixed by the protocol, because a receiver that guesses produces the wrong result silently - a garbled attachment or a page of strange characters - rather than an obvious failure that someone can diagnose.

  • Agreed format: the layout of the message and of the addresses, so the receiver knows which bits mean what.
  • Agreed order: which device sends first, what a valid reply looks like, and how the exchange is started and ended.
  • Agreed addressing: how the sender and the recipient are identified, so the data reaches the right device and the right application.
  • Agreed error handling: how corruption or loss is detected, and whether the data is acknowledged, retransmitted or discarded.
  • Agreed speed and flow control: how much data may be in flight, so a slow receiver is not swamped by a fast sender.
Do not answer "so the computers can understand each other". Name what is agreed: the format of the data and addresses, the order and timing of the exchange, and what happens when data is lost or corrupted.

Protocols as a stack

A protocol stack implements a set of protocols as a series of layers, each with its own defined function. Each layer provides a service to the layer above it and uses the service of the layer below it, and it does so without the layers above needing to know how the work is done. This is abstraction: the application layer sends its data without caring whether the link below it is copper, fibre or radio.

Each layer on the sending computer effectively communicates with the same layer on the receiving computer. The application layer on the sender and the application layer on the receiver speak the same protocol, the two transport layers speak their own protocol, and so on. Each layer adds only the control information that its own job requires.

As data passes down the stack on the sender, each layer adds its own header to the data it has been given and passes the whole thing to the layer below, so the data from the layer above becomes the payload of the layer below. This wrapping is called encapsulation. On the receiver the process runs in reverse: each layer reads and removes its own header before passing the rest up, which is decapsulation.

Layering is used because it makes an extremely complex task manageable. Each layer can be designed, tested and debugged on its own; a layer can be replaced without rewriting the others, so moving a network from copper cable to fibre changes the link layer and leaves the application layer untouched; and different manufacturers can build hardware and software that work together, provided each layer follows the agreed standard.

The stack is a model of what the software and hardware actually do, not a set of physical pipes. On a typical computer the application layer is the browser or the mail client, the transport and internet layers are provided by the operating system, and the link layer is the network interface card and its driver. A router implements only the internet layer and the layers below it, which is exactly why it can forward traffic for applications it knows nothing about.

  • Each layer has one defined job, which makes the whole system easier to design and to explain.
  • A layer can be changed or replaced without altering the others, provided its interface stays the same.
  • Layers can be developed and tested separately, so a fault can be traced to one layer instead of the whole system.
  • Standard layers let equipment and software from different manufacturers interoperate.
  • Layering hides complexity: the application does not need to know how the data is routed or transmitted.
If a question asks why layering is used, the mark is for modularity: each layer can be developed, tested and replaced independently because it only relies on the service the layer below provides.

The TCP/IP suite: four layers

TCP/IP is the protocol suite used by the internet. It is a family of protocols arranged in four layers, listed from the top down as Application, Transport, Internet and Link. It is not a single protocol, so an answer that calls TCP/IP "the protocol" has already lost a mark.

The application layer provides the services that the user's software actually uses: web pages, email, file transfer and file sharing. It contains the protocols that name those services - HTTP, FTP, SMTP, POP3, IMAP and BitTorrent - and it deals with the format of requests and responses, not with how the data will cross the network.

The transport layer is responsible for delivery between the two applications. It takes data from the application layer and breaks it into packets, adds a sequence number so the packets can be put back in order, a port number so the receiving computer knows which application the data belongs to, and error-checking data so corruption can be detected. TCP sets up a connection, acknowledges packets that arrive, arranges for missing or corrupted ones to be sent again, and reassembles the data in the right order at the destination.

The internet layer is responsible for getting a packet from one network to another across the internet. It adds the source and destination IP addresses, and it is the layer at which routing decisions are made: each router reads the destination address and forwards the packet towards it. IP is a best-effort service, so on its own it does not guarantee delivery or order.

The link layer is the layer that actually puts the data on the medium. It packages the data into a frame, adds the MAC addresses of the two devices at the ends of that particular link, and passes it to the network interface card to be transmitted over copper, fibre or radio. It also carries out error detection for each individual link.

Two consequences of this split are worth remembering. First, the internet layer is connectionless: it treats each packet as an independent unit carrying an address, and nothing in IP itself promises that the packet will arrive, that it will arrive once, or that packets will stay in order. Reliability is added by TCP at the transport layer, which is why the pair is written as TCP/IP. Second, each header is meaningful only to its peer layer, so a router can forward a packet without understanding the email inside it, and the same packet can cross an Ethernet, a fibre link and a mobile network on its way.

LayerPurposeProtocols and addresses used
ApplicationProvides the network services that the user's software uses, and defines the format of requests and repliesHTTP, FTP, SMTP, POP3, IMAP, BitTorrent; URLs and domain names
TransportDelivers data between the two applications: splits it into packets, numbers them, checks them and reassembles themTCP; port numbers
InternetMoves packets between networks and decides the route across the internetIP; source and destination IP addresses
LinkTransmits the data over the physical medium, one link at a timeEthernet and wireless standards; MAC addresses
Learn the layers with an address for each: the application layer deals in names and URLs, the transport layer in port numbers, the internet layer in IP addresses and the link layer in MAC addresses.

A message's journey down and up the stack

Follow one email from a laptop to a mail server and you can see each layer doing its own job in turn, and then the same job being undone at the other end.

On the way down, the application layer produces a message in the format its protocol defines. The transport layer treats that whole message as payload, splits it into packets and puts its own header in front of each one, containing the sequence number, the port numbers and the checksum. The internet layer treats each of those packets as payload in turn and adds an IP header with the two IP addresses. The link layer wraps the result in a frame with the MAC addresses of the next device and a trailer for error checking, and only then do bits reach the wire.

At the receiving end the process is mirrored. The link layer checks the frame, strips its header and trailer and passes the packet up; the internet layer reads the IP header, confirms the packet is for this host and removes it; the transport layer uses the sequence number to place the packet in order, acknowledges it, and when the whole message is present hands the data to the application named by the port number; the application layer finally interprets the message with SMTP, HTTP or whichever protocol the two ends agreed.

The important detail for exam answers is that a router only processes a packet up to the internet layer. It does not open the transport or application headers, because it does not need to know which application sent the data or what the message says - it needs only the destination IP address to decide where to send the packet next. That is also why the same packet can cross networks built from completely different link technologies.

  • Application layer (sender): the email client creates the message using SMTP, which defines the commands, the format of the addresses and the replies it expects.
  • Transport layer (sender): TCP divides the message into packets, numbers them, adds port numbers and a checksum, and opens a connection to the destination.
  • Internet layer (sender): IP adds the source and destination IP addresses, producing a packet that can be routed across the internet.
  • Link layer (sender): the packet is placed in a frame with the MAC addresses of the sending device and the next device on the path, and transmitted.
  • At each router: the frame is removed, the destination IP address is read, the routing table is consulted, and the packet is placed in a new frame for the next hop.
  • Link layer (receiver): the frame is checked and removed, and the packet is passed up.
  • Internet layer (receiver): the IP header is read and removed, confirming the packet has reached the right host.
  • Transport layer (receiver): the packets are put back in sequence, missing ones are requested again, and the data is passed to the correct application using the port number.
  • Application layer (receiver): the mail server reads the SMTP commands and stores the message in the recipient's mailbox.
If a question asks what a layer adds, answer with the header contents, not with the layer's name: sequence and port numbers for transport, IP addresses for internet, MAC addresses for link.

Application layer protocols: HTTP, FTP, SMTP, POP3 and IMAP

These are the protocols the syllabus names, and the exam expects the purpose of each and, for email, the direction in which each one works.

HTTP is the protocol a browser uses to request resources from a web server and the protocol the server uses to return them. It is a request-response protocol: the client sends a request naming the resource, and the server returns a status code and, if the request succeeded, the resource itself. Each request is independent of the last, which is why HTTP is described as stateless, and the protocol defines the methods such as GET and POST and the format of the headers.

FTP transfers files between a client and a server, in both directions: a user can download files from the server or upload files to it. It uses one connection for commands and a separate connection for the file data, requires a login (a username and password, or anonymous access where that is offered), and can resume an interrupted transfer instead of starting again, which makes it suitable for large files.

SMTP is a push protocol: it sends an email from the client to the outgoing mail server, and then from one mail server to another until the message reaches the server holding the recipient's mailbox. POP3 is a pull protocol used by a mail client to download messages from that mailbox to one device; in its usual configuration the messages are then deleted from the server, and it does not synchronise folders or read status between devices. IMAP also retrieves mail, but it leaves the messages on the server and keeps the client synchronised with it, so folders, read/unread state and deletions appear on every device that connects.

All five run above TCP, which is what makes them application layer protocols: they assume a reliable, ordered stream of bytes can be delivered to the other end and concentrate on what those bytes mean. HTTP does not care how a page is split into packets and SMTP does not care which route the message takes, which is exactly the separation of concerns the stack is designed to give. It is also why a fault that stops a page loading could sit in any layer, and why the layers are tested one at a time.

ProtocolPurposeKey behaviour
HTTPTransfers web pages and other resources between a web server and a clientRequest-response; stateless; defines methods such as GET and POST
FTPTransfers files between a client and a server, in either directionSeparate command and data connections; login required; can resume a transfer
SMTPSends email from a client to a mail server, and between mail serversPush protocol; used only for sending, never for collecting mail
POP3Downloads email from the mail server to one devicePull protocol; usually deletes from the server; no synchronisation between devices
IMAPReads and manages email that stays on the mail serverPull protocol; folders and read status synchronised across devices; uses more server storage
SMTP sends, POP3 and IMAP collect. If you write that POP3 sends email, or that SMTP downloads it, you lose the mark however good the rest of the answer is.

BitTorrent and peer-to-peer file sharing

BitTorrent is an application layer protocol for peer-to-peer (P2P) file sharing. In a client-server transfer such as FTP, every client downloads from one server, so the server's bandwidth limits the whole operation. In BitTorrent every computer that downloads also uploads, so the work is spread across the users themselves.

The file is divided into pieces, and a small metadata file (or magnet link) records the address of a tracker, the size of the pieces and a hash for each one. The tracker knows which peers hold which pieces. A peer asks several other peers for different pieces at the same time, checks each piece against its hash and re-requests any that are corrupt, and once it holds the whole file it becomes a seed that others can download from.

Because the pieces come from many peers in parallel, a popular file can arrive faster than from a single server, and the original publisher does not pay for all the bandwidth or act as a single point of failure. Peers that upload more are usually given priority by other peers, which encourages sharing. The costs are that the transfer depends on enough peers being online, that uploads consume the users' own bandwidth, and that the same mechanism is widely used to distribute copyrighted material without permission.

The design also changes the economics of distribution. With FTP, every extra downloader competes for the same server bandwidth, so a popular file gets slower as demand rises. With BitTorrent the total upload capacity grows as peers join, so a popular release can get faster, and the publisher only has to supply the first copy. The trade-off is that the swarm depends on those peers staying connected and on their upload speeds, and that an unpopular file with one seed may never finish.

  • Peer-to-peer: each computer is both a client and a server for the pieces it holds.
  • Tracker: keeps a list of the peers and the pieces each one has.
  • Piece and hash: the file is split up, and each piece is verified so corrupt data is discarded.
  • Seed: a peer that holds the complete file and only uploads.
  • Benefit: fast distribution of large popular files with no central server cost.
  • Drawback: slow when few peers are online, and a common route for illegal sharing.
BitTorrent is peer-to-peer, so never describe it as a client downloading a file from one server. The speed comes from many peers uploading different pieces at the same time.

Circuit switching

A circuit-switched network sets up a dedicated path between the sender and the receiver before any data is sent, and reserves that path for the whole duration of the communication. The capacity of every link on the path belongs to that connection, even during the silences when nothing is being transmitted.

Setting up the connection is a distinct phase. In the traditional telephone network, dialling asks the exchanges along the route to allocate a channel to the call; once the whole path is reserved the phone rings, and only then can speech pass. When one side hangs up, the circuit is released and its capacity becomes available to someone else.

The benefits follow from the reservation. The connection has a guaranteed bandwidth and a constant, predictable delay, because no other traffic can compete for the reserved capacity, so there is no congestion once the circuit exists. Data arrives in the order it was sent, and the network does no per-packet addressing or routing while the call is in progress, which keeps the transfer simple.

The drawbacks follow from the same reservation. Capacity is wasted whenever nothing is being sent, which is most of the time in a conversation with pauses, so circuit switching is an expensive way to carry bursty computer data. A connection must be set up before any data can flow, the number of simultaneous connections is limited by the number of circuits available, and if one link on the path fails the connection is lost and has to be established again.

The reservation is also full duplex: a telephone circuit carries both directions at once, so the two parties can speak over one another, which is part of why the service feels immediate. Nothing is queued, because nothing is competing for the capacity, and nothing has to be reassembled, because everything arrives in the order it was sent. Engineers call this a constant bit rate service: the circuit delivers a steady stream whether or not there is anything useful in it.

It is the right choice where a continuous, steady stream matters more than efficiency: ordinary voice telephony, live audio and video that must not stutter, and leased lines that give an organisation a fixed amount of bandwidth between two sites.

PhaseWhat happens
Connection setupA path is chosen and a channel is reserved in every link along it; no data can be sent until this finishes
Data transferThe whole capacity of the reserved circuit is available to the two parties, and only to them
Connection releaseOne side ends the communication, the reserved channels are freed, and the capacity can be reused
Circuit switching is not "old and therefore wrong". It guarantees bandwidth and delay, which is exactly what live voice and video need; the price is idle capacity and a connection that dies with any link on its path.

Packet switching, routers and the comparison

A packet-switched network has no reserved path. The message is broken into packets, and each packet is sent independently, sharing every link with packets from other users. Packets from the same message may travel by different routes depending on traffic and on the decisions of the routers they meet.

Every packet carries a header containing at least the source and destination IP addresses, a sequence number so the receiver can restore the order, and error-checking data so corruption can be detected. Some of the header is added by the transport layer and some by the internet layer, which is why the two-layer split matters.

A router is the device that decides where each packet goes next. It receives the packet, reads the destination IP address from the header, looks that address up in its routing table to find the best next hop, and forwards the packet to the next router on that route. The next router repeats the process, so the packet moves across the internet one hop at a time rather than being sent to the destination in a single step. If a link or router is congested or has failed, the router can choose a different next hop, which is why the network survives failures.

At the destination the packets may have arrived out of order and with different delays. The transport layer uses the sequence numbers to reassemble them in the right order, discards any that fail the error check, and asks for missing or corrupt packets to be sent again. A short delay while packets are buffered and reordered is called jitter, and it is the main reason real-time audio and video need priority treatment on a packet-switched network.

Congestion is handled by buffering. When a router receives packets faster than it can forward them it holds them in a queue in memory, and if the queue fills it discards the excess, so a busy network shows both longer delays and more lost packets. This is why real-time traffic such as voice is marked as high priority while a large download is left at low priority: without that priority, a file transfer can add enough delay to make a call unusable. Networks that can give different traffic different treatment are described as providing quality of service.

Packet switching is efficient because a link is only occupied while a packet is actually being sent, so many users share it, and it is resilient because traffic can be rerouted. It is used for almost all data: web pages, email, file transfer, file sharing and, with priority handling, voice and video over IP. The costs are variable delay, out-of-order arrival, packet loss under heavy congestion, and the processing and header overhead at every router.

  • Break up: the message is split into packets, each small enough to cross the network.
  • Label: each packet gets a header with source and destination IP addresses, a sequence number and error-checking data.
  • Route independently: each router reads the destination address, consults its routing table and forwards to the best next hop.
  • Reroute: if a link fails or is congested, later packets can take a different path.
  • Reassemble: the receiver orders the packets by sequence number and requests any that are missing.
FeatureCircuit switchingPacket switching
PathOne dedicated path, reserved for the whole communicationNo reserved path; packets share links and may take different routes
Bandwidth and delayGuaranteed and constant; no congestion once set upShared and variable; delay and jitter increase with traffic
Order of arrivalData arrives in the order it was sentPackets may arrive out of order and are reassembled by sequence number
Use of capacityWasted during silences, because the circuit stays reservedEfficient, because a link is used only while a packet is being sent
Effect of a failureThe connection is lost and must be set up againPackets are rerouted around the failure
Typical useTraditional telephone calls, live audio and video, leased linesThe internet, web, email, file transfer and file sharing
In a packet-switching answer, "the router sends the packet to the destination" loses the mark. It forwards the packet to the next router chosen from its routing table, and the process repeats hop by hop.

Key terms you must be able to define

Protocol
A set of rules governing communication between devices, covering the format of the data, the order and timing of the exchange, and what to do when data is lost or corrupted. Both sender and receiver must implement the same protocol.
Protocol stack
An implementation of a set of protocols as a series of layers, where each layer performs a defined function, provides a service to the layer above and uses the service of the layer below.
Encapsulation
The process in which data passes down the layers of a stack and each layer adds its own header, so that the data from the layer above becomes the payload of the layer below. The receiver reverses it by removing each header in turn.
TCP/IP
The protocol suite used by the internet, arranged in four layers: Application, Transport, Internet and Link. It is a family of protocols, not a single protocol.
HTTP
Hypertext Transfer Protocol. The application layer, request-response protocol used by a client such as a browser to request resources from a web server and by the server to return them, with a status code, in a stateless exchange.
FTP
File Transfer Protocol. An application layer protocol that transfers files between a client and a server in either direction, using a separate connection for commands and for data, and requiring a login.
SMTP
Simple Mail Transfer Protocol. The application layer protocol that sends email from a client to its outgoing mail server and passes messages between mail servers. It is a push protocol and does not retrieve mail.
POP3
Post Office Protocol version 3. A pull protocol used by a mail client to download messages from the server to one device; in its usual configuration the messages are then deleted from the server, and nothing is synchronised between devices.
IMAP
Internet Message Access Protocol. A pull protocol that leaves email on the server and keeps the client synchronised with it, so folders and read/unread state appear on every device that connects.
BitTorrent
An application layer, peer-to-peer file-sharing protocol. The file is split into pieces, a tracker records which peers hold which pieces, and each peer downloads different pieces from several others at once while uploading the pieces it already has.
Peer-to-peer (P2P)
A model in which each computer acts as both client and server, exchanging data directly with other computers rather than downloading everything from one central server.
Circuit switching
A method of communication in which a dedicated path is set up and reserved between sender and receiver for the whole duration of the connection, so bandwidth and delay are guaranteed but capacity is wasted when nothing is sent.
Packet switching
A method of communication in which a message is split into packets that are sent independently, share links with other traffic, may take different routes, and are reassembled in order at the destination.
Router
A device that forwards packets between networks in a packet-switched network. It reads the destination IP address from each packet header, looks the address up in its routing table and forwards the packet to the best next hop.

Applied to real systems

9618 sets its questions inside systems you already use - a phone, a school network, a supermarket till, a website, a bank. These show how to apply the theory to a context you have not seen before, then you write your own.

HTTP and the World Wide Web

When you type an address into a browser, the browser sends an HTTP request naming the resource it wants, and the web server replies with a status code and the page itself, plus any images and style sheets the page needs. The request and the response are plain, agreed text with headers, which is why any browser can talk to any web server. Each request is independent, so the server keeps no memory of your previous request unless something above HTTP provides it.

Email: SMTP, POP3 and IMAP working together

A message typed in a mail client is pushed by SMTP to the sender's outgoing mail server, which uses SMTP again to pass it to the server holding the recipient's mailbox. The recipient's client then pulls it down, either with POP3, which normally downloads it to one device and removes it from the server, or with IMAP, which leaves it on the server and synchronises folders and read status across a phone and a laptop. The same message therefore uses three different application layer protocols on its journey.

BitTorrent: distributing an Ubuntu installation image

The Ubuntu project publishes BitTorrent links alongside direct downloads for its installation images. A user's client contacts the tracker, is given a list of peers, and downloads different pieces of the image from several of them at once, checking each piece against its hash. Because every downloader also uploads, the publisher's own servers do not have to supply the full bandwidth for every copy, which is why a newly released image can be distributed to thousands of users quickly.

Circuit switching: the traditional telephone network

A landline call is the classic circuit-switched service. Dialling reserves a channel through each exchange on the route, and for the length of the call that capacity belongs to the two callers even when neither is speaking. The voice quality is steady because the bandwidth and the delay are fixed, but the reserved capacity cannot be used by anyone else until the call ends.

Packet switching: a voice call over IP

A call made with a VoIP service such as Skype is packet-switched: the speech is digitised, split into small packets and sent across the internet alongside web and email traffic. Because packets can be delayed or arrive out of order, the software buffers and reorders them, and networks give voice traffic priority so that the delay stays short enough for conversation. It shows that packet switching can carry real-time traffic, but only when delay and jitter are controlled.

Flashcards

Click a card to flip it. Mark honestly — the tracker uses this.

Q1Define a protocol and explain why one is essential for communication between two computers.
A protocol is a set of rules governing communication between devices. It covers the format of the data and addresses, the order and timing of the exchange, and what to do when data is lost or corrupted. Without it the receiver could not interpret the incoming bits, and hardware and software from different manufacturers could not work together. Both sender and receiver must implement the same protocol.
Q2What is meant by a protocol stack, how does encapsulation work, and why is layering used?
A stack implements protocols as layers, each with its own function, providing a service to the layer above and using the layer below. As data passes down the stack each layer adds its own header, so the data from the layer above becomes the payload of the layer below (encapsulation); at the receiver each header is read and removed as the data passes up. Layering gives modularity: each layer can be designed, tested and replaced independently, and standard layers let different manufacturers' systems interoperate.
Q3Name the four TCP/IP layers, from the top down.
Application, Transport, Internet, Link.
Q4What does the application layer do, and which protocols does it contain?
It provides the network services the user's software uses and defines the format of requests and responses. It contains HTTP, FTP, SMTP, POP3, IMAP and BitTorrent.
Q5What does the transport layer do?
It delivers data between the two applications: it splits the data into packets, adds sequence numbers, port numbers and error-checking data, sets up a connection, acknowledges received packets, requests retransmission of missing or corrupt ones, and reassembles the data in order at the destination. TCP works at this layer.
Q6What does the internet layer do?
It adds the source and destination IP addresses and moves packets from one network to another across the internet, with routers reading the destination address and forwarding each packet towards it. IP is best-effort: it does not itself guarantee delivery or order.
Q7What does the link layer do?
It puts the data on the physical medium: it packages the packet into a frame, adds the MAC addresses of the two devices at the ends of that link, passes it to the network interface card for transmission over copper, fibre or radio, and detects errors on that link.
Q8Give the purpose of HTTP and of FTP.
HTTP transfers web pages and other resources between a client and a web server, using a request-response exchange that is stateless. FTP transfers files between a client and a server in either direction, with separate connections for commands and data, a login, and the ability to resume a transfer.
Q9Distinguish SMTP, POP3 and IMAP.
SMTP sends email from a client to a mail server and between mail servers; it is a push protocol. POP3 downloads email from the server to one device and normally deletes it there, with no synchronisation. IMAP leaves the mail on the server and synchronises folders and read status across devices.
Q10How does BitTorrent share a file?
Peer-to-peer: the file is split into pieces, a tracker records which peers hold which pieces, and each peer downloads different pieces from several peers at once, checking each against its hash and uploading the pieces it holds. When it has the whole file it becomes a seed.
Q11What is circuit switching, and what are its main drawbacks?
A dedicated path is set up and reserved between sender and receiver for the whole connection, so bandwidth and delay are guaranteed and data arrives in order. Drawbacks: capacity is wasted during silences, setup takes time, the number of connections is limited, and a failed link ends the connection.
Q12How does a router handle a packet in a packet-switched network?
It reads the destination IP address from the packet header, looks the address up in its routing table, chooses the best next hop, and forwards the packet to the next router. The next router repeats this, so the packet travels hop by hop. It does not read the transport or application headers.
0 of 12 marked as known

Exam-style questions

8 questions, 31 marks. Write your answer, then reveal the mark scheme and tick each point you actually made. Answering honestly here is what makes the rest of the site useful.

StateAO11 mark
State the application layer protocol used to send an email from a client to its outgoing mail server.

Mark scheme — tick each point you actually made

Examiner tip: One mark, one protocol name. POP3 and IMAP collect mail rather than send it, so either of those scores nothing here.
DescribeAO12 marks
Describe two reasons why a protocol is needed for communication between two computers.

Mark scheme — tick each point you actually made

Examiner tip: Naming the protocol is not a reason. Each point must say what is agreed and why that agreement is needed; error handling and flow control are also acceptable as the second point.
ExplainAO23 marks
Explain the function of the transport layer in the TCP/IP protocol suite.

Mark scheme — tick each point you actually made

Examiner tip: Three marks need three distinct jobs. "It transports the data" restates the layer's name and scores nothing; say what it adds to the packet and what it guarantees.
DescribeAO14 marks
Describe the function of a router when forwarding packets in a packet-switched network.

Mark scheme — tick each point you actually made

Examiner tip: The fourth mark depends on saying "next router", not "the destination computer". A router forwards one hop at a time, and the routing table is what makes the decision possible.
ExplainAO24 marks
A student wants to read the same email on both a laptop and a smartphone. Explain why IMAP is more suitable than POP3 for this.

Mark scheme — tick each point you actually made

Examiner tip: The marks are for the comparison, so every IMAP point needs the POP3 contrast. Saying only that IMAP is "better for multiple devices" without saying what it synchronises is a near miss.
CompareAO25 marks
Compare circuit switching with packet switching.

Mark scheme — tick each point you actually made

Examiner tip: Each mark is a pair, not a single fact: state what circuit switching does and what packet switching does instead. Five separate benefits of one method with nothing about the other scores nothing.
ExplainAO26 marks
Explain how packet switching is used to pass a message from a sender to a receiver across the internet.

Mark scheme — tick each point you actually made

Examiner tip: Write the journey in order and keep the router step and the reassembly step separate. Answers that mention packets but never explain sequence numbers or retransmission usually stop at four marks.
DiscussAO26 marks
A hospital is planning live video consultations between doctors and patients in remote clinics. Discuss whether the hospital should use circuit switching or packet switching for these consultations.

Mark scheme — tick each point you actually made

Examiner tip: A discussion needs both sides and a decision. Award the final mark only for a justified choice that refers to the hospital's need for real-time video, not for a bare statement that one method is better.

Exam technique for this topic

  • Learn the four TCP/IP layers top down with three things for each: one sentence of purpose, the address or identifier it uses, and one named protocol. Application - services and HTTP/FTP/email protocols; Transport - packets, sequence and port numbers with TCP; Internet - IP addresses and routing; Link - frames and MAC addresses.
  • Keep the suite and the protocol separate. TCP/IP is the four-layer suite; TCP is the transport layer protocol that numbers, acknowledges and retransmits; IP is the internet layer protocol that addresses and routes. An answer that treats TCP/IP as one protocol cannot score the layer marks.
  • For "how packet switching works" questions, write the journey in order: split the message into packets, add a header with addresses and a sequence number, send each packet independently, routers read the destination address and forward to the next hop using routing tables, packets may take different routes and arrive out of order, the receiver reassembles them and requests missing ones. Order earns the marks, not length.
  • For comparison questions, pair the points rather than listing the benefits of one and then the other: dedicated path against shared links, constant against variable delay, in order against out of order, wasted capacity against efficient sharing, and a failed link killing the call against automatic rerouting.
  • For router questions, never say the router sends the packet to the destination computer. It reads the destination IP address, consults its routing table and forwards the packet to the next router, and the process repeats. Mention that a router only processes the packet up to the internet layer and does not read the transport or application headers.

Why students lose marks here

A student wroteA student wrote: "TCP/IP is the protocol used to send an email across the internet."
Why it loses marksTCP/IP is a suite of protocols arranged in four layers, not a single protocol. Email is sent by SMTP at the application layer, and TCP/IP is the whole stack of protocols that carries it. The answer names the suite where a named protocol was needed and explains no layer.
The answer that scoresTCP/IP is the protocol suite used by the internet, organised as four layers: Application, Transport, Internet and Link. Email is handled at the application layer by SMTP, which sends the message from the client to its mail server and between mail servers. The transport layer, using TCP, splits the message into numbered packets, adds port numbers and a checksum, acknowledges delivery and retransmits anything missing. The internet layer, using IP, adds the source and destination IP addresses and lets routers forward each packet, and the link layer puts each packet into a frame with MAC addresses for transmission over the physical medium.
A student wroteA student wrote: "SMTP is used to collect email from the server and POP3 is used to send it to the server."
Why it loses marksThe two directions are reversed. SMTP is a push protocol used for sending; POP3 and IMAP are pull protocols used for collecting. The answer also ignores IMAP, which is the protocol that keeps several devices synchronised.
The answer that scoresSMTP is the push protocol: it sends email from the client to the outgoing mail server, and then from one mail server to another until the message reaches the server holding the recipient's mailbox. POP3 and IMAP are the pull protocols used by the recipient's client to collect the message. POP3 normally downloads the messages to one device and deletes them from the server, so nothing is synchronised. IMAP leaves the messages on the server and synchronises folders and read/unread state, so the same mailbox can be read on a phone and a laptop.
A student wroteA student wrote: "Circuit switching is best for the internet because every message gets its own dedicated line, so nothing can go wrong."
Why it loses marksThe internet is packet-switched, and a dedicated circuit for every message would be impossible to afford or to scale. The answer also misses the two real drawbacks: capacity is reserved and wasted when nothing is sent, and a single failed link breaks the whole connection. It does not say where circuit switching genuinely is applicable.
The answer that scoresCircuit switching reserves a dedicated path for the whole duration of a connection, so bandwidth and delay are guaranteed and data arrives in order, which suits continuous real-time traffic such as a telephone call or live video. It is unsuitable for the internet's bursty data traffic because the reserved capacity is wasted during silences, the connection takes time to set up, the number of simultaneous connections is limited, and the loss of any link on the path ends the connection. Packet switching is used instead: links are shared only while packets are actually being sent, and packets can be rerouted around a failure.
A student wroteA student wrote: "A router forwards each packet to the destination computer using its MAC address."
Why it loses marksA router forwards a packet to the next router on the route, not directly to the destination, and the decision is made from the destination IP address in the packet header, not from a MAC address. MAC addresses belong to the link layer and identify devices at the two ends of one link.
The answer that scoresA router receives a packet, reads the destination IP address from its header, and looks that address up in its routing table to find the best next hop. It then forwards the packet to the next router on that route, and the next router repeats the process, so the packet crosses the internet one hop at a time. The destination IP address identifies the network and host that the packet is ultimately for, while the MAC addresses in the frame identify only the two devices at the ends of the current link, and they are replaced at every hop. If a link is congested or has failed, the router can choose a different next hop.
A student wroteA student wrote: "In packet switching all the packets follow the same route, so they arrive in the correct order and none can be lost."
Why it loses marksPackets in the same message are routed independently and may take different paths, so they can arrive out of order and some can be delayed or dropped. The sequence numbers and the retransmission in TCP exist precisely because packets are not guaranteed to arrive in order or at all.
The answer that scoresIn packet switching each packet is sent independently and routers decide the next hop for each one, so packets from the same message may travel by different routes and arrive out of order, with different delays. Each packet carries a sequence number, and the transport layer at the destination uses it to reassemble the message in the correct order. Packets that fail the error check are discarded, and TCP arranges for missing or corrupt packets to be retransmitted. Delay that varies from packet to packet is called jitter, and it is why real-time audio and video need priority handling.