Module 076 min

Conversations and trust

Two handshakes happen before a single byte of your page arrives: one to agree the conversation, one to agree that the far end is who it claims.

After this module
  • You can explain what the three packets of a TCP handshake establish, and why a connection can be refused instantly but hang forever.
  • You can name the three things a certificate proves, and the two clock conditions that make a valid one fail.

A page load looks instant. Underneath, before any content arrives, there are two round trips of negotiation and a third to fetch the document — and on a 150 ms connection, that is half a second of pure setup.

7.1TCP: agreeing to talk

IP delivers packets. It does not promise they arrive, arrive once, or arrive in order. TCP adds those promises by keeping state at both ends.

TWO HANDSHAKES, THREE ROUND TRIPS client server SYN SYN-ACK ACK · ClientHello ServerHello · certificate · keys
In TLS 1.3 the first application request can ride along with the final handshake message, which is why it is one round trip instead of two.

TCP also recovers from loss. Every byte is numbered; the receiver acknowledges what it has; anything unacknowledged is sent again after a timeout. That is why a connection can survive a lost packet without you noticing — and why a lossy link turns into latency rather than errors.

Try it · what each packet establishes6 steps

The client picks a random starting sequence number and a source port, and asks to open a connection to port 443. Nothing is established yet; the server has to decide whether to allocate state.

7.2Refused, timeout, and what each proves

Three outcomes of the same command, three different faults.
ResultWhat happenedWhere to look
Connection refusedSomething answered with a reset — the machine is reachable, the port is not openThe service, its bind address, its process
TimeoutNothing came back at all — the packet was droppedFirewall, route, NAT, or the host is down
Reset mid-sessionState was lost after the connection openedA middlebox, a timeout, or the service died

That distinction is worth more than any single command. "Refused" means the network works and the application does not. "Timeout" means the network did not deliver the question.

7.3Certificates: what the padlock promises

A certificate is a signed statement that a particular key belongs to a particular name, valid between two dates, issued by someone your machine already trusts. It proves three things: the server holds the private key, the name matches what you asked for, and a certificate authority vouched for the binding at some point.

It does not prove the site is honest, safe, or well run. It proves you are talking to the domain you typed, over a channel nobody can read.

The trap · the certificate that was fine yesterday

The most common real outage in this course is an expiry. The second most common is a clock problem: a machine five minutes behind rejects a perfectly valid certificate with "not yet valid". Both look like the site is broken and neither is a network fault. Check the dates (openssl s_client | openssl x509 -dates) and the clock (timedatectl) before anything else.

7.4HTTP/2, HTTP/3, and why the version matters

HTTP/1.1 opened a connection per request, or reused one and queued behind it. HTTP/2 multiplexes many requests over one connection, so a page with eighty assets no longer needs eighty connections — but a single lost packet still stalls every stream, because TCP delivers in order.

HTTP/3 runs over QUIC, which is built on UDP and recovers each stream independently. It also survives a change of address: your phone switching from Wi-Fi to mobile data keeps the same connection. The catch is that UDP 443 is blocked in more networks than TCP 443 is, so clients fall back — quickly, silently, and usually without anyone noticing that the optimization never applied.

Check yourselfQuestion 1 of 1

A browser reports "certificate is not yet valid" for a site that works for everyone else. What is the most likely cause?

60-second recap

  • TCP is state at both ends. Sequence numbers, acknowledgements and retransmission turn IP into a stream.
  • Refused and timeout are different faults. One is the application, the other is the path.
  • TLS proves identity, not honesty. Expiry and clock skew are the two failures that look like outages.