Why three steps to say hello?

Two segments wouldn't be enough. TCP needs both sides to prove they can send and receive, and both sides need to pick and confirm a random initial sequence number so both ends can track exactly which bytes have been sent and received.

ClientCLOSED ServerLISTEN

Packet log

Press "Next" to begin the handshake.

TCP flag glossary

FlagMeaning
SYN"Synchronize" — requests a new connection and proposes an initial sequence number.
ACKAcknowledges data or a control flag was received; carries the "ack" number, which is always one more than the last byte received.
PSH"Push" — tells the receiving OS to hand the data straight to the application instead of buffering it, used for interactive data.
FIN"Finish" — sender has no more data to send and wants to close its side of the connection.
RST"Reset" — abruptly aborts a connection, e.g. when a segment arrives for a port nothing is listening on. Not part of a normal handshake or teardown.
URG"Urgent" — marks part of the segment as needing out-of-band priority handling. Rarely used in modern applications.

Common gotchas