Networking
The Basics of the TCP 3-Way Handshake
SYN, SYN-ACK, ACK — the three-way handshake explained as the foundation for everything that rides on TCP.
- tcp
- fundamentals
(view full size, opens in a new tab)
Before diving into this post, I want to be clear that I will assume a basic understanding of networking and will not talk about what a protocol is, what an IP network is, or other similar concepts.
TCP, short for Transmission Control Protocol, is one of the main protocols used in TCP/IP networks throughout the world. TCP offers a number of benefits over other protocols on the internet by guarenteeing delivery of data and ensuring that packets are delivered in the correct order for re-assembly.
Before we can reap the benefits of TCP though, we have to establish a connection with a remote server, and for that, we need the TCP 3-Way Handshake.
The TCP 3-way handshake is how TCP sets up a TCP/IP connection over an IP-based network. As the name implies, to establish a TCP connection, there are three actions to establish the connection:
- The client who would like to establish a connection with the remote server sends a SYN or synchronization packet.
- The server responds with a SYN-ACK or synchronization acknowledgement packet.
- The client receives the server's acknowledgement and responds with it's own ACK or acknowledgement packet. Once received by the server, the connection is established.