Establishing Connections With TCP's Three Way Handshake | Network Fundamentals Part 8 TCP is connection-oriented, while UDP is connectionless. TCP achieves this with a process called the three-way handshake.
This is three messages between the client and server, which use the SYN and ACK flags in the TCP header.
There is a corresponding process when closing the connections. This time the FIN flag in the header comes into play.
And in other cases, the RST flag is used. This is in the case of an error, which can help with troubleshooting.