Circuit and packet switching
An old phone call held one line open for the whole conversation, even through the pauses; a chat app sends short bursts that squeeze in between everyone else’s. A circuit-switched connection reserves a path before communication. Packet switching divides a message into addressed portions that share network capacity.
A gallery’s exhibit controller sends GALLERY|OPEN|18:20 to a remote display. It sends only occasional status changes; a live audio guide would produce a continuous stream.
The path A → B → D is held for one conversation, even while nothing is being said.
Read each row across: one consequence, and how each method handles it.
| Consequence | Circuit switching | Packet switching |
|---|---|---|
| Before sending | Set up a dedicated circuit; setup takes time. | No dedicated circuit needs reserving. |
| Capacity | Reserved even during silence; predictable rate once set up. | Shared by many senders; efficient for bursts. |
| Route and order | Same path; data stays in order. | Packets may take different paths and arrive out of order. |
| Failure and delay | A broken path interrupts the connection. | Other routes may remain available; queuing and reassembly add variable delay. |
Which method suits which use
- Bursts of exhibit updates suit shared packet capacity.
- A reserved circuit can suit a sustained conversation needing a steady rate, if its setup time and reserved capacity are acceptable.
- Release the circuit’s reserved channels when the conversation ends.
1 Which method reserves a path before any data is sent?
2 A camera streams video all day without a pause. A door sensor sends a message only when the door opens. Which method suits each?
3 Give one drawback of a reserved circuit when data comes in short bursts.
- 1circuit switching
- 2camera: a reserved circuit can suit its steady, continuous stream; door sensor: packet switching, because occasional bursts can share capacity
- 3the reserved capacity is wasted during the silences (and setting up the circuit takes time)
Packet delivery through routers
Once a message is cut into packets, each one travels on its own, like letters posted separately. Every packet needs a destination address. Routers choose its next hop; the receiving endpoint uses sequence information to recover the message’s original order.
Follow the exhibit controller’s 18-character message GALLERY|OPEN|18:20 to the remote display. It is split into three six-character payloads. The labels 1–3 show their order in the message.
The sender’s router is R1 and the display’s router is R4; R2 and R3 are the two routers between them.
Each packet carries source 192.0.2.18 and destination 198.51.100.46, as well as ordering information.
| Packet label | Payload | Route |
|---|---|---|
| 1 | GALLER | R1 → R2 → R4 |
| 2 | Y|OPEN | R1 → R3 → R4 |
| 3 | |18:20 | R1 → R2 → R4 |
The same routes drawn out. Packets 1 and 3 go through R2, packet 2 through R3, so they need not arrive in the order sent.
Send → attach addressing and ordering information; forward packets independently.
At a router → read the destination IP address, consult its routing table and forward to the selected next hop.
- R1 chooses R2 or R3 from its routing information: a next hop, not a whole fixed route written into the packet.
- Changed routes or congestion can send later packets along a different path.
1 What does a router read in each packet to choose the next hop?
2 Which packet goes through R3?
3 The packets reach the display in the order 3, 1, 2. What message does the display rebuild, and what tells it the order?
- 1the destination IP address, looked up in its routing table
- 2packet 2
- 3GALLERY|OPEN|18:20: the sequence information (labels 1, 2, 3) in each packet
Packet loss and reassembly
Three packets leave in the order 1, 2, 3 and the last one turns up first; another may not turn up at all. Receiving them is not enough: an endpoint must recover the complete message in its original order. Sequence information reveals the order and any gaps.
The exhibit message GALLERY|OPEN|18:20 was divided into payloads 1 = GALLER, 2 = Y|OPEN and 3 = |18:20. They can arrive in a different order from the order sent.
Each row shows the receiver’s three slots just after one more packet arrives. Blue marks the packet that has just come in.
- After 3 arrives, the end is present but the start is missing.
- After 1 arrives there is a gap at slot 2: do not join 1 straight to 3.
- When 2 arrives, the order 1, 2, 3 recovers GALLERY|OPEN|18:20.
Detect and recover missing data
Spotting a gap is only half the job: the missing data has to be sent again.
Detect → error checks reveal damaged data; sequence information reveals a gap.
Recover → TCP uses acknowledgements and timing to detect missing data and retransmit it.
Reassemble → retain valid received data, place recovered data in order, and supply the complete stream to the application.
- Only the missing data needs retransmitting.
- Buffering out-of-order data and waiting for recovery use memory and add delay.
- Packet switching gives flexible shared routes, but the delivery protocol must handle loss and order.
When a route fails
- If the R2 route becomes unavailable, a later or retransmitted packet may travel through R3.
- A packet’s hop limit decreases at routers; when it expires the packet is discarded, preventing endless circulation.
- End-to-end recovery is still needed if that packet’s data has not reached the display.
1 Packets 2 and 3 have arrived but packet 1 has not. What can the receiver conclude?
2 Which protocol notices missing data and has it sent again?
3 What stops a lost packet circulating between routers for ever?
- 1the start of the message is missing: wait for packet 1 and do not deliver a broken message
- 2TCP, using acknowledgements, timing and retransmission
- 3its hop limit: it decreases at each router and the packet is discarded when it expires
Protocols and layers
One maker’s display reads another maker’s controller only because both keep the same rules. A protocol specifies rules that communicating systems agree to follow: how data is represented, exchanged and interpreted. A protocol suite combines protocols with different jobs.
What each layer needs
Read from the top: each job can only be done if the job below it is done first.
Exhibit application → needs a request and reply that both ends can interpret.
Reliable transport → needs addressed packets to reach the other endpoint.
Internet routing → needs a local link to carry each packet to its next hop.
Link delivery → needs frames and signals that the adjacent devices can handle.
Down one stack, across the cable, up the other. The dashed lines are agreements, not wires.
- 1A layer provides a service to the layer above and uses the service below. Inside one device, data moves between adjacent layers through defined interfaces.
- 2Corresponding layers at opposite endpoints follow the same protocol rules.
- 3They have no separate physical wire between them: only the bottom layer is connected, by cable or radio.
Why use layers
Each reason leads to a practical gain in the same row.
| Reason for layers | Practical consequence |
|---|---|
| Each layer has a distinct responsibility. | A transport problem can be investigated separately from an application’s message format. |
| Interfaces define the service offered. | A wired link can be replaced by a suitable wireless link while the application still requests the same service. |
| Protocol rules are agreed. | Different implementations can exchange messages if they follow those rules. |
1 What is a protocol?
2 A gallery replaces a cable with a wireless link. Which layer’s job changes, and must the application change?
3 Give one reason for dividing communication into layers.
- 1an agreed set of rules for how data is represented, exchanged and interpreted
- 2the link layer (local delivery); no, the application still requests the same service through the same interface
- 3each layer has one job, so a problem can be investigated in one layer, or one layer can be replaced without changing the others
The four TCP/IP layers
A present goes into a box, the box into a padded bag, the bag into a sack, and they come off in the opposite order. A message is wrapped the same way. The TCP/IP suite has four layers: Application, Transport, Internet and Link. Sending adds control information; receiving removes and uses it in the reverse order.
Sending and receiving
Read down the sender, then up the receiver.
How encapsulation wraps the data
Read from the middle out: each layer wraps what it was given.
What each wrapper adds to GALLERY|OPEN|18:20:
| Layer | What it contributes to the exhibit message |
|---|---|
| Application | Creates the HTTP request/response and the status content the application understands. |
| Transport | TCP adds ports and sequence/error-control information for delivery between the endpoint processes. |
| Internet | IP adds source and destination network addresses so routers can forward the packet. |
| Link | Encapsulates the IP packet in a frame for this link, using local addressing and error checking. |
Encapsulation wraps the next layer’s data with control information. Receiving reverses the nesting: Link extracts the IP packet; Internet passes up the TCP segment; TCP supplies the ordered application data.
1 Name the four TCP/IP layers from the top.
2 Which layer adds the source and destination IP addresses?
3 On receiving, which layer takes the IP packet out of the frame?
- 1Application, Transport, Internet, Link
- 2Internet
- 3Link
TCP, IP and the link
A courier carrying a parcel to the next depot only needs the next stop; the label says where it finally goes. Delivering a packet splits the work the same way. TCP manages reliable, ordered delivery between endpoints. IP addresses packets and supports routing across networks. The Link layer moves the packet over one local hop.
An exhibit controller sends a packet to a display with IP address 198.51.100.46. Router R1 chooses R2 as the next hop towards the display’s router R4.
A router forwards the packet inside a new frame
Controller → R1 → a local frame carries an IP packet addressed to 198.51.100.46.
Inside R1 → remove the incoming frame; inspect the packet’s destination IP address; choose R2 from the routing table.
R1 → R2 → place that IP packet in the frame required by the outgoing link.
At the display → the complete endpoint stack receives the data and TCP orders it for the application.
What changes at each hop
Violet: the link header, new on every hop. Blue: the IP header, whose destination stays and whose hop limit falls.
| Information | Across this routed journey |
|---|---|
| Destination IP address | Identifies the final network/host; it remains 198.51.100.46 in this trace. |
| Link addresses | Identify the local sender/next receiver; they change as new frames are made for successive links. |
| TCP sequence information | Allows the destination endpoint to order the byte stream and recognise missing data. |
| IP hop limit | Decreases at routers; the packet is discarded when its permitted lifetime expires. |
What TCP adds that IP does not
IP gets each packet towards the right place, but makes no promises.
- TCP uses acknowledgements, sequencing and retransmission to deliver a complete ordered stream.
- IP is connectionless: each packet is routed independently and IP alone does not promise arrival or ordering.
- A switch’s local frame forwarding is a different task from a router’s next-network choice.
1 Which address stays the same for the whole journey?
2 The packet leaves the controller with hop limit 64. What is it when R4 forwards it to the display?
3 Which protocol promises complete, ordered delivery: TCP or IP?
- 1the destination IP address, 198.51.100.46
- 261: R1, R2 and R4 each take one off
- 3TCP; IP alone does not promise it
HTTP and FTP
Opening a status page and storing a photo on a shared server both cross the same network, but one asks a question and the other moves a whole file. Choose an Application-layer protocol from the service needed. HTTP exchanges web requests and responses; FTP transfers files between a client and server.
Two jobs in one picture. HTTP: the display asks for the status and gets it back. FTP: one image file goes up to the file server and later down to the display.
HTTP: fetch the status page
Display’s HTTP client → exhibit web server → request the current status resource.
Web server → display → return a response containing the status data.
Display application → interpret GALLERY|OPEN|18:20 and update the visible page.
FTP: upload and download a file
Curator’s FTP client → file server → authenticate where required and upload a replacement exhibit image.
Display’s FTP client ← file server → download the image file to local storage.
HTTP means Hypertext Transfer Protocol; FTP means File Transfer Protocol. Both rely on lower layers to carry their messages.
1 The display asks the web server for the current status. Which protocol?
2 The curator uploads a new exhibit image to the file server. Which protocol?
3 Write HTTP and FTP in full.
- 1HTTP: a request, then a response
- 2FTP
- 3Hypertext Transfer Protocol; File Transfer Protocol
Email protocols
An email makes two journeys: out to the recipient’s mail server, then from that server to whoever reads it. SMTP sends mail. POP3 and IMAP let a receiving client access mail held by its server. Sending and mailbox access are different stages.
Follow the notice: SMTP carries it twice, then the display client collects it with POP3 or IMAP.
SMTP does all the sending. The real choice is how the mailbox is read:
| Protocol | Mailbox behaviour and suitable use |
|---|---|
| SMTP · Simple Mail Transfer Protocol | Pushes outgoing mail from a client to its server and onward between mail servers. |
| POP3 · Post Office Protocol 3 | Downloads messages to a client; it can remove server copies after retrieval. Useful when mail is kept primarily on one device. |
| IMAP · Internet Message Access Protocol | Keeps mail on the server and synchronises message/folder state. Useful when the curator checks the same mailbox on several devices. |
Choose POP3 or IMAP
- One device keeping its own mail: consider POP3.
- Several devices needing the same mailbox state: choose IMAP.
- POP3 need not delete server mail, but keeping a copy does not give IMAP’s synchronisation.
1 Which protocol moves the notice from the curator’s client to the sending server?
2 Which protocol carries it from the sending server to the receiving server?
3 A guide reads the same mailbox on a phone and a laptop and wants the same folders on both. POP3 or IMAP?
- 1SMTP
- 2SMTP
- 3IMAP: it keeps mail on the server and synchronises its state
BitTorrent and peer-to-peer sharing
When many computers want the same large file, one server sending every copy becomes a bottleneck. BitTorrent shares a file in pieces among peers. A peer can download pieces and upload pieces it already holds, spreading the transfer load across the group.
The exhibit’s authorised media pack has pieces A, B, C and D. A seed holds the complete pack. East and West hold different pieces and exchange them directly.
Follow the arrows: the seed gives each peer different pieces, then East and West swap what they have.
The tracker locates peers; peers supply the file
- A tracker may coordinate discovery without serving the media pack. No single central file server has to supply every piece.
- If East leaves, its pieces must be available from another peer or the seed. Many peers do not guarantee that every piece is currently available.
- BitTorrent is an application protocol. “Peer-to-peer” does not mean the computers are cabled in one particular topology.
1 What does a torrent descriptor hold?
2 What does a tracker do? Does it send the media pack?
3 East holds pieces A and C. Which pieces can it upload, and which must it still download?
- 1metadata that identifies the file and its pieces, not the media itself
- 2it helps peers find the swarm; no, the peers supply the pieces
- 3upload A and C; download B and D
Choosing the route and protocol
Why does the display show OPEN at 18:20? Because of a service, a delivery mechanism and a network route: each answers a different question, and together they explain one complete communication.
At the gallery, the controller sends status messages such as GALLERY|OPEN|18:20 to remote displays. A packet from the controller travels via router R1, then R2 or R3, to the display’s router R4.
Each need decides one choice; read across for the reason.
| Need at the exhibit | Choice and decisive reason |
|---|---|
| Occasional status updates | Packet switching shares links between bursts; tolerate variable network delay. |
| Display requests the current web status | HTTP exchanges a request and a resource response. |
| Managed upload of an image file | FTP moves the named file from client to server. |
| Curator reads mail on two devices | IMAP retains and synchronises one server mailbox. |
| Many displays share a large media pack | BitTorrent peers contribute pieces as they receive them. |
Follow one status response all the way
Use the evidence in a description to name the layer. Each numbered point matches a mark on the figure.
- 1Application: the server builds the HTTP response carrying GALLERY|OPEN|18:20. Interpreting an HTTP request points here.
- 2Transport: TCP identifies endpoint processes and supplies sequencing, acknowledgements and recovery. Missing-data recovery and ordered delivery point here.
- 3Internet: IP supplies the destination; each router looks it up. A destination-network lookup points here.
- 4Link: a new frame carries the packet over each hop. A frame on one local hop points here.
- The display removes each layer’s control information in reverse order and delivers the response to the display application.
- A packet taking R3 instead of R2 changes its route, while its application service stays HTTP.
1 A missing segment is sent again and the display puts the data back in order. Which layer is doing this?
2 R1 looks up 198.51.100.46 to choose its next hop. Which layer?
3 A packet goes through R3 instead of R2. Does the application protocol change?
- 1Transport (TCP)
- 2Internet (IP)
- 3no: only the route changes; the service is still HTTP