All about Three-Way Handshake Protocol
Posted on July 4th, 2019
The TCP three-way handshake in Transmission Control Protocol is a method used in a TCP/IP network. TCP is a connection-oriented protocol, which means a connection is established and maintained until the application programs at each end have finished exchanging messages. TCP uses a process called three-way handshake to negotiate the sequence and acknowledgment fields and start the session and ending the session. ‘Connection-oriented’ does not mean that TCP sets up a physical path between the sender and the receiver. It only means that the two hosts are kept in a state of ‘awareness’ regarding the transmission. This is done via the three-way handshake of the TCP protocol. UDP, on the other hand, does not even check if the receiver is ready to receive the message. Hence it is a ‘connectionless’ service.
The three-way handshaking technique is often referred to as “SYN-SYN-ACK”. For example, when you ping a machine you are sending an SYN signal which is ACK by the remote machine then it sends an SYN-ACK signal back to the remote machine. Then the host machine receivers SYN-ACK and sends the ACK signal back to confirm the same.
What is TCP and Key Features of TCP
TCP (Transmission Control Protocol) – breaks information into datagrams and sends them, carrying out resends, if required, and reassembles received datagrams, it gives ‘reliable’ delivery, a connection-oriented service between applications. The Key features of TCP are listed below.
1) Connection-oriented: TCP is connection-oriented service, means it all segments follow the same path, and segments are in the order delivered, a connection needs to be established before two devices can communicate. An application requests a “connection” to destination and uses the connection to transfer data.
2) Reliable: The protocol itself checks to see if everything that was transmitted was delivered at the receiving end.
3) Error and flow control: Error-checking, error control also includes a mechanism for correcting errors, flow-control-Flow Control basically means that TCP will ensure that a sender is not overwhelming a receiver by sending packets faster than it can consume, and acknowledgment functions.
4) Point to Point: TCP connection ensures that packets to arrive at their intended destinations uncorrupted and in the correct sequence, thereby making the point-to-point connection virtually error-free.
5) Stream Data transfer: It is the duty of TCP to pack this byte stream to packets, known as TCP segments, which are passed to the IP layer for transmission to the destination device.
6) An application requests a “connection” to destination and uses the connection to transfer data
7) Routability: TCP/IP is a routable protocol.
8) It helps in resolving the logical address.
9) Name resolution: It helps in solving human-readable name into IP address.
10) Full Duplex: Each TCP connection supports a pair of byte streams, one flowing in each direction.
What is TCP handshaking?
The procedure that takes place between two TCP/IP nodes to establish a connection. Known as the Synchronization, Synchronize-Acknowledgment and Acknowledgment handshake. For example, if computer A transmits a Synchronize packet to computer B, which sends back a Synchronize-Acknowledge packet to computer A. Computer A then transmits an Acknowledge packet to computer B and the connection is established. This whole above-said process is called the TCP handshaking.
TCP – Exchange of State Information Protocols
1) Two-Way Handshake Protocol
2) Three-Way Handshake Protocol
If A wants to transfer money to B, so A sends an SYN to B, and then B sends an ACK to A. Connection is established and then A can send his money and then drop the connection after it’s done. If there is a delayed duplicate SYN from A to B, B will send its ACK again and A will be transferring its money again. That is one of the weaknesses of a two-way handshake. The three-way handshake can solve this problem.
TCP 3-Way Handshake Process
To establish a connection, the three-way (or 3-step) handshake occurs:
The active open is performed by the client sending an SYN to the server that is the client wants to establish a connection with the server, which has a random sequence number. The client sets the segment’s sequence number to a random value X.
In response, the server replies with an SYN-ACK, containing a random sequence number and an ACK number acknowledging the client’s sequence number. The acknowledgment number is set to one more than the received sequence number i.e. X+1, and the sequence number that the server chooses for the packet is another random number, Y.
In the final part, the client acknowledges the response of server and they both establish a reliable connection with which they will start eh actual data transfer. The client sends an ACK back to the server. The sequence number is set to the received acknowledgment value i.e. X+1, and the acknowledgment number is set to one more than the received sequence number i.e. Y+1.
If you need any further help, please do reach our support department.