1.9
TCP, UDP, TLS and QUIC: Connections and Security
Reliable vs fast transport, the handshakes, loss and retransmission, encryption, HTTP/3 and HSTS.
38 min Reading + animations
Tip: tap or hover any dotted-underlined term to see what it means.
By the end of this lesson you will be able to
- Explain what the transport layer adds on top of IP, and choose between TCP and UDP for a given job.
- Walk through the TCP three-way handshake with real sequence numbers, and explain what happens when a SYN is lost, a port is closed, or a server is flooded.
- Explain how TCP makes delivery reliable: sequence numbers, ACKs, retransmission (timeout and fast retransmit), reordering, flow control and congestion control.
- Describe how a connection closes (FIN,
TIME_WAIT, RST) and why reusing connections matters at scale. - Explain head-of-line blocking and how HTTP/1.1, HTTP/2 and HTTP/3 differ.
- Walk through the TLS 1.3 handshake, say what a certificate proves, and recognise each certificate error.
- Explain what QUIC and HSTS add, and count the round trips each setup costs.
#Why we need a transport layer
After DNS gives the browser an IP address, the browser still has a problem. IP delivers packets from one machine to another, on a best-effort basis: packets can be lost, duplicated, delayed or arrive in a different order, and IP will not tell anyone. IP also knows only machines, not programs.
The transport layer sits on top of IP and solves both problems:
- Ports pick out the program. The server’s web server listens on port 443 (HTTPS) or 80 (HTTP); your browser uses a temporary (ephemeral) port such as 53000. The four values source IP, source port, destination IP, destination port identify one conversation.
- Delivery guarantees, if you want them. This is where the two main protocols differ:
- TCP (Transmission Control Protocol) delivers data reliably and in order, keeping the sequence correct.
- UDP (User Datagram Protocol) sends data fast but without a connection and without guarantees. It is also the foundation of QUIC.
On top of either one, TLS (Transport Layer Security) encrypts the traffic and proves who the server is. HTTPS is simply HTTP running inside TLS.
#TCP vs UDP
TCP vs UDP: the same job, two philosophies
TCP sets up a connection and guarantees ordered delivery. UDP just sends and hopes. Compare what happens on a good day and on a bad one.
Scenario
Handshake first, then numbered data, every byte acknowledged.
Before any data, TCP asks: “Can we talk?” Nothing useful is sent yet; this is pure setup.
| TCP | UDP | |
|---|---|---|
| Connection | Yes: a handshake before any data | No: the first packet already carries data |
| Reliability | Lost data is detected and resent | Lost data stays lost (the app may retry) |
| Ordering | Bytes reach the app in the order sent | Each datagram stands alone, any order |
| Data model | A continuous byte stream | Separate messages (datagrams) |
| Flow and congestion control | Built in | None (the app must be polite itself) |
| Header size | 20–60 bytes | 8 bytes |
| Speed to first byte | At least one round trip of setup | Immediate |
| Typical uses | Web (HTTP/1.1, HTTP/2), email, SSH, file transfer, databases | DNS, video and voice calls (VoIP, WebRTC), online games, live streaming, QUIC/HTTP/3 |
The rule of thumb: if every byte must arrive and in order (a web page, a bank transfer, a file), use TCP. If fresh data matters more than complete data (the position of a player in a game, the next 20 ms of a voice call), or the exchange is one tiny question and answer (DNS), use UDP.
#Opening a TCP connection
Once it has the server’s IP address, the browser either creates a new transport connection or reuses one it already has to that server. Reuse is common: a browser keeps connections open for a while precisely to avoid the setup cost you are about to see.
#The three-way handshake
For HTTPS over TCP, a new connection starts with three segments:
The TCP three-way handshake
Each side picks a random starting number (ISN) and the other side confirms it. Watch the numbers and the connection states.
Scenario
SYN, SYN-ACK, ACK: one round trip.
The web server has told its OS: “accept connections on port 443”. The socket is in the listening state.
1. SYN: client → server
The client wants to start a connection, for example from client port 53000 to server port 443. It sets the SYN (synchronize) flag and picks a random Initial Sequence Number (ISN), say 1000.
2. SYN-ACK: server → client
The server accepts. It sets SYN (with its own ISN, say 5000) and ACK (acknowledgment) with
ack=1001: “I received your SYN; next I expect byte 1001.” If the client is behind NAT, this reply actually arrives at the router’s public IP and mapped port, and the router forwards it inside.3. ACK: client → server
The client confirms the server’s number with
ack=5001. Both directions are now synchronized and the TCP connection is established. That cost one full round trip (RTT) before any data.
After this, an HTTPS connection usually performs the TLS handshake to set up security and encryption, and only then sends the HTTP request.
Why three messages and not two? Each side has to announce its own starting number and hear the other side confirm it. The server’s SYN and its ACK of the client’s SYN travel together in one segment, so four logical messages fit into three segments. Random ISNs make it hard for an attacker to guess the numbers and inject fake data into someone else’s connection.
During the handshake the two sides also agree options: the maximum segment size (MSS), window scaling (allowing large windows), and whether selective acknowledgment (SACK) is supported.
#When the handshake goes wrong
Play the other scenarios in the animation above:
- SYN lost. The client hears nothing, waits about 1 second, and resends. Each retry doubles the wait (1, 2, 4, 8 s…), which is called exponential backoff. After roughly five or six attempts the OS reports connection timed out. A page that “hangs for a few seconds, then loads” is often a lost SYN.
- Closed port. If the machine is up but nothing listens on that port, its OS answers the SYN with RST (reset). The application gets connection refused immediately. If instead a firewall silently drops the SYN, there is no RST, just retries and finally a timeout. So fast refusal means “host up, port closed”, and slow timeout means “filtered or unreachable”.
- SYN flood. An attacker sends huge numbers of SYNs from fake addresses and never sends the final ACK. Each one occupies a slot in the server’s queue of half-open connections, and real users are turned away: a denial of service (DoS), or DDoS when many machines join in. The classic defence is SYN cookies: the server stores nothing and instead encodes the connection details, with a secret hash, into its own ISN. Only a real client that received the SYN-ACK can return the right number. Large sites also absorb floods at the CDN or load balancer.
Self-checkQuestion
A client sends SYN with seq=4000. The server replies SYN-ACK with seq=9000. What acknowledgment number does the client put in its final ACK?
#Reliable delivery: sequence numbers and ACKs
TCP treats the data in each direction as one long stream of bytes and numbers every byte. Each segment carries the number of its first byte (seq); the receiver answers with the number of the next byte it expects (ack).
Sequence numbers, ACKs and retransmission
After the handshake (client ISN 1000, server ISN 5000) the server sends a 5000-byte response in five 1000-byte segments.
Scenario
How seq and ack count bytes.
The client sends a 100-byte request. Its first byte is number 1001 (ISN + 1, because the SYN used up 1000).
A worked example, continuing the handshake above (client ISN 1000, server ISN 5000):
| Segment | Direction | seq | Bytes | ack sent back |
|---|---|---|---|---|
| HTTP request (100 bytes) | client → server | 1001 | 1001–1100 | 1101 |
| Response part 1 | server → client | 5001 | 5001–6000 | 6001 |
| Response part 2 | server → client | 6001 | 6001–7000 | 7001 |
| Response parts 3–5 | server → client | 7001… | 7001–10000 | 10001 |
Three details that interviewers like:
- ACKs are cumulative.
ack=7001confirms everything before 7001, so one ACK can cover several segments. Receivers often acknowledge every second segment (delayed ACK) to save packets. - The sender does not wait for each ACK. It keeps several segments in flight at once, up to its window. Waiting for every ACK would make a 100 ms link crawl.
- SYN and FIN each count as one byte, which is why the first data byte is ISN + 1.
#When a segment is lost
TCP has two ways to notice a loss:
- Retransmission timeout (RTO). When it sends data, the sender starts a timer, set from the measured round-trip time (a little over one RTT, at least 200 ms on Linux). If no ACK arrives in time, it resends. This is the slow path, and TCP reads it as serious congestion: the timeout doubles and the sending rate drops to the minimum.
- Fast retransmit. If segment 2 is lost but segments 3, 4 and 5 arrive, the receiver answers each with the same
ack=6001(“I still want 6001”). These are duplicate ACKs. After three duplicate ACKs the sender concludes that one segment is missing while the network still works, and resends it immediately without waiting for the timer.
#Out-of-order delivery and reassembly
Packets can take different paths through the internet, so segment 3 may arrive before segment 2 even when nothing is lost. The receiver keeps out-of-order segments in its buffer, delivers to the application only the bytes that are in order, and hands up the rest as soon as the gap is filled. The application never sees the reordering. The flip side: while one segment is missing, everything behind it waits. Remember this; it is called head-of-line blocking.
#How the response gets back to your browser
Here is the full return path from the notes: the server replies, the home router translates the address, then TCP, TLS and the browser each do their part.
How the response finds its way back
From the server, through the home router’s NAT, up through TCP and TLS to the browser.
Scenario
The laptop’s packet leaves from private address 192.168.1.10, port 53000.
| Stage | Source IP:Port | Destination IP:Port |
|---|---|---|
| Server → internet | 198.51.100.20:443 | 203.0.113.25:62001 |
| After the router’s NAT | 198.51.100.20:443 | 192.168.1.10:53000 |
The router looks up port 62001 in its NAT mapping and sends the response to the right computer. On the computer, TCP delivers the data in the right order, TLS decrypts it (and checks it was not altered), and the browser processes the HTTP response and displays the page.
#Flow control and congestion control
A fast sender can overwhelm two different things: the receiver, and the network in between. TCP has a separate brake for each.
Flow control and congestion control
Two different brakes: one protects the receiver, the other protects the network.
Scenario
The receive window says how much room is left.
Every ACK carries a window: how many more bytes the receiver’s buffer can take right now. Here 4000.
- Flow control (protects the receiver). Every ACK carries a receive window (rwnd): how many more bytes the receiver’s buffer can take right now. If the application reads slowly, the window shrinks, possibly to zero, and the sender must pause (sending only tiny window probes) until the window reopens.
- Congestion control (protects the network). The sender also keeps a congestion window (cwnd), its own guess of how much the path can carry. It may send at most the smaller of cwnd and rwnd.
- Slow start: begin small (modern stacks: 10 segments) and add one segment per ACK, which doubles cwnd every round trip. Despite the name, growth is exponential.
- Congestion avoidance: after reaching a threshold (ssthresh), grow by only one segment per round trip.
- On loss: after three duplicate ACKs, halve cwnd and continue; after a timeout, drop back to the minimum and slow-start again.
The result is a “sawtooth”: speed climbs until a router’s queue overflows, halves, and climbs again. This is how millions of connections share the same links fairly. Modern algorithms such as CUBIC (the default on Linux, Windows and macOS) and Google’s BBR shape the curve differently, but the idea is the same.
Lesson 1.10 takes this apart in detail: every header field, how the timeout is computed, SACK, zero windows and window scaling, the exact slow-start and AIMD rules, CUBIC vs BBR, and the bandwidth-delay product.
#Closing a connection
Closing a connection: FIN, TIME_WAIT and RST
Scenario
Each direction is closed separately: four segments.
The client has nothing more to send and sends FIN (finish). It can still receive.
- Graceful close (FIN). Each direction closes separately. The side that is done sends FIN; the other side ACKs it and may keep sending until it too sends FIN, which is then acknowledged: four segments (often three, when the second FIN rides with the ACK).
TIME_WAIT. The side that closed first waits about a minute (twice the maximum segment lifetime; 60 s on Linux) before forgetting the connection. This lets it re-ACK a FIN whose ACK was lost, and stops delayed old packets from being mistaken for a new connection on the same ports.- RST (abort). A reset tears the connection down instantly, without the FIN exchange and without
TIME_WAIT; unsent data is lost. You see RST when a port is closed, when an application crashes or aborts, after a server reboot (packets for an unknown connection), and from some firewalls. Applications report it as connection reset by peer.
A busy client that opens and closes a connection for every request can pile up tens of thousands of sockets in TIME_WAIT and run out of local ports. The cure is the same as before: reuse connections.
#Head-of-line blocking and the HTTP versions
Head-of-line blocking means one slow or missing item holds up everything queued behind it, like a stalled car at the front of a single-lane road. It appears at two levels.
Head-of-line blocking: HTTP/1.1, HTTP/2, HTTP/3
The page needs three files: style.css, app.js and logo.png. See what one slow response or one lost packet does in each version.
Scenario
The old HTTP/1.0 habit: a handshake per file.
Two round trips just to get a secure connection.
| How requests share connections | Head-of-line blocking | |
|---|---|---|
| HTTP/1.0 style | A new TCP (+ TLS) connection per request | Every file pays a full handshake and slow start |
| HTTP/1.1 | Keep-alive: requests reuse a connection, but one at a time; browsers open up to 6 connections per host | HTTP level: a slow response blocks the ones behind it on that connection |
| HTTP/2 | Multiplexing: many streams interleaved on one TCP connection | HTTP-level blocking gone, but TCP level remains: one lost segment stalls every stream |
| HTTP/3 | Streams over QUIC (UDP), each ordered independently | A lost packet only delays its own stream |
Keep-alive and connection reuse are the foundation of all three modern versions: the handshake cost is paid once and spread over many requests. HTTP/2 goes further and needs only one connection per site, which also means one congestion window that warms up properly. Its weakness shows on lossy networks (mobile, crowded Wi-Fi), where a single loss freezes the whole page; HTTP/3 was designed to fix exactly that.
#TLS: securing the connection
TLS (Transport Layer Security) encrypts network traffic to keep information safe, and helps verify the server’s identity. Its predecessor SSL is obsolete, though people still say “SSL certificate”. TLS gives three guarantees:
- Confidentiality: nobody on the path can read the data (encryption).
- Integrity: nobody can change the data without being detected (each record carries an integrity tag).
- Authentication: you are really talking to
www.example.com, not an impostor (certificates).
#Two kinds of cryptography
- Symmetric encryption uses one shared key to lock and unlock (for example AES). It is very fast, so all the actual data is encrypted this way. The problem: how do two strangers agree on a key over a network anyone can listen to?
- Asymmetric (public-key) cryptography uses a key pair: a public key anyone may know and a private key that never leaves its owner (for example RSA or elliptic-curve keys). It is much slower, so TLS uses it only during the handshake: to agree on a shared key (Diffie-Hellman key exchange, ECDHE) and to sign things (certificates, CertificateVerify).
#The TLS 1.3 handshake
The TLS 1.3 handshake
Runs right after the TCP handshake. Goal: agree a secret key nobody else knows, and prove the server is really www.example.com.
Scenario
ClientHello lists TLS versions and cipher suites it supports, a random number, and already a key share (an ephemeral ECDHE public key). SNI names the site it wants (www.example.com) so a server hosting many sites picks the right certificate; ALPN offers application protocols (h2, http/1.1).
1. ClientHello (client → server)
The client sends the TLS versions and cipher suites it supports, a random value, and already a key share (its half of the key exchange). Two important extensions: SNI (Server Name Indication), naming the site it wants so that a server hosting many sites picks the right certificate, and ALPN (Application-Layer Protocol Negotiation), offering
h2orhttp/1.1.2. ServerHello (server → client)
The server picks the version and cipher suite and sends its own key share. Both sides can now compute the same shared secret, which never crossed the network. Everything after this point is encrypted.
3. Certificate, CertificateVerify, Finished (server → client)
The server sends its chosen ALPN protocol, its certificate chain, a CertificateVerify signature over the handshake made with the certificate’s private key (proof it owns the certificate), and Finished, a keyed hash of the whole handshake that detects any tampering.
4. Finished + first request (client → server)
The client checks the certificate, sends its own Finished and, in the same flight, the first HTTP request. TLS 1.3 costs one round trip (1-RTT); TLS 1.2 needed two.
#Session resumption and 0-RTT
After a handshake the server can give the client a session ticket. Next time, the client presents it as a pre-shared key (PSK) and the handshake skips the certificate. With 0-RTT, the client even sends its first request (early data) inside the very first flight, so no round trip is spent waiting.
The catch is replay: an attacker who recorded that first flight can send it again, and the server cannot tell. Harmless for GET /home, dangerous for POST /transfer-money. So servers accept 0-RTT only for safe, idempotent requests, or disable it.
#Certificates and the chain of trust
A certificate says: “this public key belongs to www.example.com, valid from date A to date B”, signed by a Certificate Authority (CA). Usually the site’s certificate (the leaf) is signed by an intermediate CA, which is signed by a root CA. Your OS or browser ships with a trust store of about 150 root CAs. Trust flows down the chain from a root you already have.
What the browser checks in a certificate
The server sends its own certificate plus the intermediate. The root is already in your device.
Scenario
Leaf: “www.example.com, public key …, valid 2026-08-01 to 2026-10-30, signed by Example Intermediate CA”. Intermediate: “Example Intermediate CA, signed by Example Root CA”.
The browser checks:
- Name: the hostname you typed is listed in the certificate (
*.example.comcoverswww.example.combut notexample.comora.b.example.com). - Dates: today lies between “not before” and “not after”. Public certificates issued since 15 March 2026 last at most 200 days, falling to 100 days in 2027 and 47 days in 2029, so renewal must be automated (Let’s Encrypt, cloud certificate managers; see lesson 2.7).
- Signature chain: each certificate is signed by the next, up to a trusted root.
- Revocation: the certificate has not been cancelled early, checked via OCSP (often stapled by the server) or revocation lists (CRL).
- Possession: CertificateVerify proves the server holds the private key.
| What went wrong | Typical browser error | What it usually means |
|---|---|---|
| Certificate expired | NET::ERR_CERT_DATE_INVALID | Renewal failed, or your own clock is wrong |
| Wrong hostname | NET::ERR_CERT_COMMON_NAME_INVALID | Misconfigured server/CDN, missing SNI, or an impostor |
| Self-signed / unknown issuer | NET::ERR_CERT_AUTHORITY_INVALID | A lab certificate, a corporate inspection proxy, or a MITM attack |
| Revoked | NET::ERR_CERT_REVOKED | The key was compromised or the certificate mis-issued |
In every case the browser stops before sending your request, cookies or password. A man-in-the-middle (MITM) on café Wi-Fi can relay your packets but cannot produce a valid certificate for someone else’s site, because it lacks that site’s private key. The attack only works if the user clicks through the warning.
#QUIC and HTTP/3
QUIC (originally Quick UDP Internet Connections) is a modern, fast and secure transport protocol built on UDP, and it is what HTTP/3 runs on. It reimplements what TCP does (acknowledgments, retransmission, flow and congestion control) and adds what TCP could not:
- TLS 1.3 built in. Transport and encryption are set up together: 1-RTT for a new connection, 0-RTT on resumption. Even most transport headers are encrypted.
- Independent streams. Data is ordered per stream, so a lost packet delays only its own stream: no TCP-level head-of-line blocking.
- Connection migration. A QUIC connection is identified by a connection ID, not by IP and port. When your phone moves from Wi-Fi to mobile data and its IP changes, the connection continues; a TCP connection would break and start over.
- Runs in user space. It ships inside browsers and servers, so it improves without waiting for OS updates.
QUIC in action
QUIC runs over UDP port 443 and carries TLS 1.3 inside. Connections are identified by connection IDs, not by IP and port.
Scenario
The first QUIC packet carries the TLS ClientHello and a connection ID. Even the transport headers are mostly encrypted, so middleboxes cannot tamper with them.
Two practical caveats. Some networks (offices, hotels) block UDP port 443; browsers then fall back to TCP + TLS + HTTP/2, so every HTTP/3 server must also offer TCP. And browsers discover HTTP/3 support from an Alt-Svc response header or a DNS HTTPS record, so the very first visit often still uses TCP.
#The round-trip budget
Every round trip before the first request is pure waiting. On a 50 ms path (roughly Dhaka to Singapore):
Round trips before the first request: the latency budget
Assume a 50 ms round trip, roughly Dhaka to Singapore. Count the waiting before “GET /” can leave.
Scenario
TCP handshake starts.
| Setup | Round trips before the request | At 50 ms RTT |
|---|---|---|
| TCP + TLS 1.2 | 3 | 150 ms |
| TCP + TLS 1.3 | 2 | 100 ms |
| QUIC (TLS 1.3 inside) | 1 | 50 ms |
| QUIC with 0-RTT resumption | 0 | 0 ms |
| TCP + TLS 1.3 with 0-RTT | 1 (the TCP handshake) | 50 ms |
| Reused (kept-alive) connection | 0 | 0 ms |
DNS lookup time comes on top of all of these, and so does an HTTP-to-HTTPS redirect, which is one reason for HSTS.
#HSTS: forcing HTTPS
HSTS (HTTP Strict Transport Security) forces the browser to always use the secure HTTPS protocol for a site. A site sends it as a response header over HTTPS:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
From then on, for max-age seconds (here one year), the browser rewrites any http:// link to https:// itself, before anything leaves your machine, and turns certificate errors into hard failures with no “proceed anyway” button.
HSTS: never talk plain HTTP again
You type example.com without “https://”. What happens depends on whether the browser already knows the site’s HSTS policy.
Scenario
With no policy known, the browser starts with plain HTTP on port 80. Anyone on the path can read and change this request.
The weakness is the first visit: before the browser has ever seen the header, typing example.com starts with plain HTTP, and an attacker on the network can keep you on HTTP (SSL stripping). The fix is the HSTS preload list: sites that qualify submit their domain, and browsers ship with the list built in, so even the first visit goes straight to HTTPS. Whole TLDs such as .dev and .app are preloaded.
#TCP, UDP and TLS in system design
- TLS termination. Load balancers and CDNs usually terminate TLS: they hold the certificate, decrypt, and talk to backends over a private network (or re-encrypt). This centralises certificates and moves crypto work off app servers. Terminating at a CDN edge near the user also makes handshakes faster, since the RTT is short.
- Connection pooling and keep-alive between services and to databases avoid handshakes, slow start and
TIME_WAITexhaustion. - Long-lived connections (WebSockets, streaming APIs) need keep-alives to survive NAT timeouts, and load balancers must be configured with idle timeouts longer than the keep-alive interval.
- Picking the transport. Use TCP (or QUIC) for anything that must be complete. Use UDP for real-time media, game state and discovery, and accept that the application handles loss.
- Enable HTTP/2 and HTTP/3 at the edge; they help most for mobile users on lossy networks.
- Automate certificates and monitor expiry dates: an expired certificate is one of the most common and most avoidable outages.
#Try it yourself
# See the TCP connect, TLS handshake, certificate and HTTP exchange
curl -v https://example.com -o /dev/null
# * Connected to example.com (...) port 443
# * SSL connection using TLSv1.3 / ... <- negotiated version and cipher
# * ALPN: server accepted h2 <- HTTP/2 chosen through ALPN
# * Server certificate: subject: CN=www.example.org ...
# Timing of each phase: DNS, TCP connect, TLS handshake, first byte
curl -so /dev/null -w "dns %{time_namelookup} tcp %{time_connect} tls %{time_appconnect} ttfb %{time_starttransfer}\n" https://example.com
# Inspect the certificate chain and TLS details directly
openssl s_client -connect example.com:443 -servername example.com
# Try HTTP/3 (curl built with HTTP/3 support)
curl --http3 -I https://cloudflare.com
# List your open TCP connections and their states (ESTABLISHED, TIME_WAIT...)
netstat -an # Windows, macOS, Linux
ss -tan # Linux: TCP sockets with state
ss -uan # Linux: UDP sockets
In Wireshark, capture while opening a site and use the display filter tcp.flags.syn==1 to see only handshakes (SYN and SYN-ACK). Use tcp.analysis.retransmission to find resent segments, tls.handshake for TLS handshakes, and quic for HTTP/3 traffic. Notice that after the ServerHello, TLS 1.3 shows only “Application Data”: even the certificate is encrypted.
#Summary
Key takeaways
- IP delivers packets on a best-effort basis to a machine; the transport layer adds ports (which program) and, with TCP, reliable ordered delivery.
- TCP: connection-oriented, reliable, ordered, with flow and congestion control. UDP: connectionless, 8-byte header, no guarantees, ideal for DNS, calls, games and as the base of QUIC.
- The three-way handshake (SYN, SYN-ACK, ACK) exchanges random ISNs and costs one RTT. A lost SYN is retried with backoff; a closed port answers RST; SYN floods are countered with SYN cookies.
- seq numbers bytes and ack names the next byte expected. Loss is repaired by timeout (slow) or fast retransmit after 3 duplicate ACKs; out-of-order data is buffered and reassembled.
- Flow control (receive window) protects the receiver; congestion control (slow start, avoidance, halving cwnd on loss) protects the network. New connections start slow, so reuse connections.
- Connections close with FIN (four segments, then
TIME_WAITon the closer) or abort with RST. - Head-of-line blocking: HTTP/1.1 at the HTTP level, HTTP/2 at the TCP level, HTTP/3 over QUIC avoids both.
- TLS gives confidentiality, integrity and authentication. TLS 1.3 takes 1 RTT (ClientHello with key share, SNI, ALPN; ServerHello; Certificate, CertificateVerify, Finished), resumption allows 0-RTT with a replay risk. Browsers check name, dates, chain to a trusted root and revocation.
- QUIC = UDP + built-in TLS 1.3 + independent streams + connection migration; falls back to TCP when UDP is blocked. HSTS forces HTTPS; the preload list covers the first visit.
Answer on your own first, then read the explanation, even when you got it right.
Self-checkQuestion
Which four values together identify one TCP connection on the internet?
Self-checkQuestion
Which two of these jobs are better suited to UDP than to TCP?
Choose 2
Self-checkQuestion
Why does TCP need three messages to open a connection, not two?
Self-checkQuestion
Why does each side pick a random initial sequence number instead of starting at 0?
Self-checkQuestion
A connection to 203.0.113.80:5432 fails at once with “connection refused”. A connection to 203.0.113.80:6379 hangs for about a minute and then times out. What do the two errors tell you?
Self-checkQuestion
A user’s first SYN is lost. What happens next on a typical client?
Self-checkQuestion
During a SYN flood, how do SYN cookies keep a server available?
Self-checkQuestion
A busy service opens a new TCP connection for every outgoing request and starts failing with “cannot assign requested address”. Tens of thousands of sockets sit in TIME_WAIT. What is the right fix?
Self-checkQuestion
Which side of a TCP connection enters TIME_WAIT, and why?
Self-checkQuestion
An API client logs “connection reset by peer” right after the server’s application crashed. What does that mean at the TCP level?
Self-checkQuestion
Why do browsers open up to six TCP connections to the same host for HTTP/1.1?
Self-checkQuestion
A hotel network blocks UDP port 443. What happens when a browser visits a site that supports HTTP/3?
Self-checkQuestion
Which is not one of the guarantees TLS gives?
Self-checkQuestion
Why does TLS use both asymmetric and symmetric cryptography?
Self-checkQuestion
One server at 198.51.100.20 hosts 200 HTTPS websites. How does it know which certificate to present to a new client?
Self-checkQuestion
What does ALPN decide during the TLS handshake?
Self-checkQuestion
On a path with an 80 ms round trip, how long does a new connection spend on handshakes before the client can send its HTTP request, with TCP and TLS 1.3?
Self-checkQuestion
A site enables TLS 1.3 0-RTT. Which two requests are safe to accept as early data?
Choose 2
Self-checkQuestion
A certificate is issued for *.example.com. Which two names does it cover?
Choose 2
Self-checkQuestion
Only one employee’s laptop shows ERR_CERT_DATE_INVALID for every HTTPS site, while phones on the same Wi-Fi work. What is the most likely cause?
Self-checkQuestion
Inside a company network, every HTTPS site shows ERR_CERT_AUTHORITY_INVALID on a new personal laptop, but company laptops work. What is happening?
Self-checkQuestion
With today’s typical HTTPS, which two things can an observer on the café Wi-Fi still see?
Choose 2
Self-checkQuestion
A user on a video call walks out of the house and the phone moves from Wi-Fi to mobile data. Why can a QUIC connection survive this when a TCP connection cannot?
Self-checkQuestion
A site has just enabled HTTP/3, yet the very first visit of a new user still uses HTTP/2 over TCP. Why?
Self-checkQuestion
A site sends HSTS correctly, yet a first-time visitor on hostile Wi-Fi is kept on plain HTTP by an attacker. What closes this gap?
Self-checkQuestion
A team wants to roll out HSTS for the domain and all its subdomains. Some internal subdomains may still serve plain HTTP. What is the safe plan?
Self-checkQuestion
Why do large systems usually terminate TLS at the load balancer or CDN edge instead of on every application server?
Self-checkQuestion
A server sends segments starting at seq 5001, 6001, 7001, 8001 and 9001 (1000 bytes each). The segment at 6001 is lost; all others arrive. What does the client keep acknowledging, and what happens next?
Self-checkQuestion
Why can HTTP/2 be slower than HTTP/3 on a lossy mobile network?
Self-checkQuestion
A café hotspot intercepts your HTTPS connection to your bank and presents its own certificate for the bank’s name. What stops it?