Before any data flows, TCP opens a connection with three messages: SYN, SYN-ACK and ACK. A sequence diagram, with one vertical line per machine and one arrow per message, is the clearest way to show it, especially when the arrows appear one click at a time.
The three messages
- SYN. The client picks an initial sequence number x and sends a segment with the SYN flag set.
- SYN-ACK. The server picks its own initial sequence number y and replies with SYN and ACK set, acknowledging x + 1.
- ACK. The client acknowledges y + 1. Both sides now know the other's starting sequence number, and data can flow in both directions.

Why three, not two?
Each side must learn that the other received its starting sequence number. Two messages would confirm the client's number to the server, but the server would never know whether its own reached the client. The third message closes that gap. It also protects against an old, delayed SYN opening a ghost connection.
The bigger picture: opening a web page
Students often meet the handshake as an isolated fact. Placing it in a full exchange shows where it fits: a DNS lookup first, then the handshake, then the HTTP request and response.

From there it is easy to discuss what a lost message does: draw it with -x and let the class work out which side times out and retransmits.
Build it in Tracé, from text
Open Science → Sequence diagram and write one message per line:
participant C as Client participant S as Server C -> S: SYN (seq = x) S --> C: SYN-ACK (seq = y, ack = x+1) C -> S: ACK (ack = y+1) note over C, S: Connection established
->is a message,-->a reply (dashed),-xa lost message.- A Mermaid
sequenceDiagramcan be pasted as it is, includingautonumberandNote over. - Press Reveal one message per click and present.
The AI builder knows the format too: "explain the TCP handshake and connection teardown, one message per click" gives you the slides to edit.
Questions
Can I show the four-way teardown too?
Yes: FIN, ACK, FIN, ACK between the two lifelines, with a note for the TIME_WAIT state.
Does it work for other protocols?
Any message exchange: TLS, DHCP, a REST call, a radio link's signalling, or a classroom dialogue between three characters.
More: Animated math slides for teachers · How to create math slides, step by step


