A three-way-handshake is primarily used to create a TCP socket connection. It works when:A client node sends a SYN data packet over an IP network to a server on the same or an external network. The objective of this packet is to ask/infer if the server is open for new connection.The target server must have open ports that can accept and initiate new connections. When the server receives the SYN packet from the client node, it responds and returns a confirmation receipt - the ACK packet or SYN/ACK packet.The client node receives the SYN/ACK from the server and responds with an ACK packet.