The client sends a segment with the SYN flag, the server answers SYN+ACK, and the client confirms with ACK. Both sides now know each other’s initial sequence numbers and the connection is ESTABLISHED.
Three-way handshake
SYN, SYN-ACK, ACK: how TCP opens a connection.