University of Melbourne · FACULTY OF COMPUTER SCIENCE

COMP30023 · Computer Systems

- one subject, every graph, every model, every mark
Computer Science14 Chapters10-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 9 of 13 · COMP30023

HTTP and UDP

Week 8 covers the web and the lightweight transport: HTTP/1.1 requests and responses, persistent versus non-persistent connections and how many TCP connections a page load needs, and UDP as a connectionless best-effort datagram service. Counting the minimum TCP connections for a multi-server page, dissecting an HTTP GET, and choosing UDP over TCP are standard exam items.

In this chapter

What this chapter covers

  • 01The web: client, server and URL (scheme + host + path); a page pulls objects from many servers
  • 02HTTP request/response structure: request line, header lines, blank line, optional body; status-code classes (1xx-5xx)
  • 03HTTP methods and their properties: GET/HEAD (safe, idempotent), POST/PUT/DELETE; safe vs idempotent
  • 04Persistent (HTTP/1.1) vs non-persistent (HTTP/1.0) connections; pipelining; connections per page load
  • 05HTTPS = HTTP over TLS (port 443); brief note on HTTP/2 (header compression, multiplexing) and HTTP/3 over QUIC
  • 06The transport layer's job: a logical channel between processes on top of the best-effort network layer
  • 07Multiplexing/demultiplexing via port numbers; well-known (0-1023), registered and ephemeral port ranges
  • 08UDP: an 8-byte header (source/destination port, length, checksum), connectionless, no flow/error control; when to prefer it
Worked example · free

Minimum TCP connections for a multi-server page

Q [3 marks]. Using persistent HTTP/1.1, a browser loads a page from server A that embeds one image also hosted on A and two images hosted on server B. What is the minimum number of TCP connections needed, and why? (3 marks)
  • +1Under HTTP/1.1 connections are persistent by default: after a response the TCP connection to a host stays open, so subsequent requests to that same host reuse it rather than opening a new connection each time.
  • +1The base page and the same-host image both come from server A, so a single TCP connection to A can carry all of A's request/response exchanges (the page and its image).
  • +1Server B is a different host — a different IP:port endpoint — so it needs its own TCP connection, which carries both of B's images. Minimum = 1 connection to A + 1 connection to B = 2. The distractor is to count one connection per object (which would give 4); persistent HTTP/1.1 reuses one connection per host.
Two TCP connections: one to server A (carrying the page and its same-host image) and one to server B (carrying its two images). Persistent HTTP/1.1 reuses a single connection per host for all objects from that host, so you count hosts, not objects.
Sia tip — Count distinct hosts, not objects — that is the whole trick. Note this is the minimum; a browser may open parallel connections per host for speed, and HTTP/1.0 (non-persistent) would need a fresh connection per object. Ask Sia to vary the object/host layout and check that your count follows the one-connection-per-host rule.
Glossary

Key terms

HTTP (HyperText Transfer Protocol)
The application-layer protocol of the web: a client opens a TCP connection (port 80, or 443 for HTTPS) and exchanges request/response messages. A request has a request line (method, path, version), header lines, a blank line and an optional body; a response has a status line, headers and data.
Persistent vs non-persistent connection
HTTP/1.0 uses a separate (non-persistent) TCP connection per object; HTTP/1.1 keeps the connection open (persistent) so subsequent requests to the same host reuse it, lowering setup overhead. Pipelining sends several requests back-to-back without waiting for each response.
Safe vs idempotent method
A safe HTTP method (GET, HEAD) is for retrieval only and should not change server state. An idempotent method (GET, HEAD, PUT, DELETE) has the same effect whether performed once or many times. POST is neither safe nor idempotent.
Multiplexing / demultiplexing
Combining several application streams into one shared transport stream (mux) and splitting them back out at the receiver (demux), done using port numbers. Port ranges: well-known 0-1023, registered 1024-49151, dynamic/ephemeral 49152-65535.
UDP (User Datagram Protocol)
A connectionless transport that sends independent datagrams over IP with an 8-byte header (source port, destination port, length, checksum). Its only service beyond IP is multiplexing (ports); it offers no flow control, no reliability and no retransmission — fast and low-overhead.
When to prefer UDP over TCP
When the application wants low overhead and control over timing and does not need reliable, in-order delivery: short request/response (DNS) and real-time media (VoIP, where loss concealment beats waiting for retransmission). TCP is preferred when reliable, ordered, congestion-controlled byte streams are needed.
FAQ

HTTP and UDP FAQ

How many TCP connections does a web page need?

It depends on HTTP version and how many distinct hosts serve the objects. With persistent HTTP/1.1, the minimum is one connection per host, reused for all that host's objects — so a page whose objects come from two servers needs at least two connections. With non-persistent HTTP/1.0 you need a separate connection per object. Browsers may also open several parallel connections per host to speed loading, but the exam usually asks for the minimum, which counts hosts, not objects.

What is the difference between persistent and non-persistent HTTP connections?

A non-persistent connection (HTTP/1.0) is used for a single object then closed, so each object costs a fresh TCP setup (an extra round trip) plus per-connection OS overhead. A persistent connection (HTTP/1.1) stays open after the response, so subsequent requests to the same host reuse it, and the client can send the next request as soon as it sees a referenced object — lowering overall response time. Pipelining goes further, sending multiple requests without waiting for each response.

When should an application use UDP instead of TCP?

Use UDP when you want low overhead and fine control over timing and can tolerate loss or reordering: DNS lookups (short request/response, where TCP setup would dominate) and real-time media like VoIP (where a late retransmitted packet is useless and loss concealment fills the gap). UDP adds only multiplexing (ports) over IP — no flow control, no reliability, no retransmission — so use TCP when you need a reliable, ordered, congestion-controlled byte stream.

What is in a UDP header and what does the checksum cover?

The UDP header is 8 bytes: source port, destination port, UDP length and UDP checksum. The checksum covers the UDP header and data plus an IPv4 pseudoheader (source and destination addresses, protocol number 17 and the UDP length), so it can catch some misdelivery as well as corruption. UDP is connectionless, so a socket is a 3-tuple but each packet still carries the full 5-tuple's worth of addressing to be demultiplexed to the right process.

Can AI help me with HTTP and UDP in COMP30023?

Yes. Sia can dissect a sample HTTP GET, quiz you on status codes and method properties, work through minimum-connection counting, or contrast UDP and TCP services step by step, checking your reasoning. It is a study aid for the networking half; it does not do your graded exam, quizzes or projects, and University of Melbourne academic-integrity rules apply.

Study strategy

Exam move

Week 8 is examined in the final and rewards a few crisp rules, so make them automatic. Learn the HTTP request/response structure (request line, headers, blank line, body) and the status-code classes, and be able to dissect a sample GET (URL = Host header + path, version at the end of the request line, Connection: keep-alive means persistent, and note the trap that the client IP is not in the HTTP message). Nail the connection-counting rule: persistent HTTP/1.1 uses one connection per host, so count hosts not objects. For UDP, memorise the 8-byte header, that its only service over IP is multiplexing, and the clear cases for choosing it (DNS, real-time media) versus TCP. Rehearse the TCP-vs-UDP service matrix as a boxed answer. These are quick marks; confirm the exam date on Canvas and keep building toward your WAM.

Working through HTTP and UDP in COMP30023? Sia is AskSia’s AI Computer Science tutor — ask any COMP30023 HTTP and UDP question and get a clear, step-by-step explanation grounded in how COMP30023 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 14 of your University of Melbourne subjects - and 1,000+ Bibles across every Australian university.
Sia - your COMP30023 tutor, unlimited, worked the way the exam marks it
The full 10-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$25/ month
30-day money-back · cancel in one tap · how it works
Unlock the full COMP30023 Bible + 14 University of Melbourne subjects解锁完整 COMP30023 Bible + University of Melbourne 14 门科目
$25/mo