When two computers want to talk to each other (the client and the server), and they know to use TCP ahead of time, they establish a connection using a three-way handshake. It goes a little something like this:
SYN: The client sends a
SYNTCP packet to the server
SYN-ACK: In response, the server replies with a
ACK: Finally, the client sends an
ACKTCP packet back to the server
There are three steps, which is why it's called the three-way handshake.