The TCP 3-way handshake also is known as TCP-handshake. It contains three message handshake or SYN, SYN-ACK, ACK. It is the method for TCP/IP connection over an IP-based network. TCP’s 3-way handshaking is often called SYN, SYN-ACK, ACK technique because there are three messages transmitted by TCP to negotiate and start a TCP session between two hosts.
Hosts on the network read all data segments within a session and exchange information about what data is received using the information in the TCP header. TCP is a full-duplex protocol, where each logical connection represents two one-way communication streams or sessions. To set up the connection, the hosts do a TCP 3-way handshake. Control bits in the TCP header show the progress and status of the connection.
The TCP handshake method is designed for hosts attempting to communicate and can negotiate the limits of the TCP socket connection before transmitting data. This is the 3-way handshake process also designed for both ends can start and negotiate separate TCP socket connections at the same time.
It is being able to negotiate multiple TCP socket connections in both directions at the same time allows a single physical network interface, such as Ethernet, to be multiplexed to transfer multiple streams of TCP data simultaneously. The figure below illustrates the TCP 3-way handshake.
The steps of the TCP 3-way handshake is following:-
The host sends a TCP SYNchronize packet to the server
The server receives Host’s SYN
The server sends a SYNchronize-ACKnowledgement to host
The host receives the server’s SYN-ACK
The host sends ACKnowledge to Severs
The server receives ACK.
Both sending data.
When data sending is complete then the sessions are going to close because of finishing sending data. The connection and session mechanisms also enable TCP’s reliability. For termination of the connection, another 3-way communication is going to perform and tear down the TCP socket.
This setup and teardown of a TCP socket connection is part of what qualifies TCP as a reliable protocol. TCP also acknowledges successful data receiving and guarantees the data is reassembling in the correct order.
The transmission control protocol (TCP) is a network communication protocol designed to send data packets over the Internet. It is a transport layer protocol in the OSI model. It creates a connection between remote computers by transporting and ensuring the delivery of messages over supporting networks and the Internet.
When the application layer requires sending a large amount of data, it sends the data to the transport layer for transmission control protocol (TCP) or User Datagram Protocol (UDP) to transport it across the network.
The transmission control protocol (TCP) first establishes a connection between the source and destination in a three-way handshake process. After connection establishment, it breaks the data into segments, adds a header to each segment, and sends them to the Internet layer. The transmission control protocol (TCP) header is 20 to 24 bytes in size, and the format is shown in the Figure below.
When the Application layer sends data to the transport layer, TCP sends the data across using the following sequence:
Transmission Control Protocol (TCP) three-way handshake
TCP uses a three-way handshake to establish a connection between client and server. The three-way handshake has three steps. It uses the SYN and ACK flags in the Code Bits section of the header. This process is necessary to start the sequence and acknowledgement number fields, which are important for TCP. A three-way handshake is also known as a TCP handshake. The following figure illustrates the TCP three-way handshake.
As shown in the above figure, the source starts the three-way handshake by sending a TCP header to the destination with the SYN flag set. The destination responds with the SYN and ACK flag sent. Examine that the destination uses the received sequence number plus 1 as the Acknowledgement number. This is because it is assumed that 1 byte of data was contained in the exchange. The source responds with only the ACK bit set in the final step. After this, the data flow can commence.
Data Segmentation
The data size transmitted across a single Internet layer PDU is limited by the protocol used in that layer. This limit is called the maximum transmission unit (MTU). The application layer may send data much larger than this limit; hence, TCP has to break down the data into smaller segments. Each segment is limited in size to the MTU. Sequence numbers are used to identify each byte of data. The sequence number in each header signifies the byte number of the first byte in that segment.
Flow Control
Flow control ensures the rate at which a sender is transmitting is proportional to the receiver’s receiving capabilities. It manages the flow of data/packets among two different nodes, especially in cases where the sending device can send data much faster than the receiver can take in.
The TCP process initializes when the source sends data in groups of segments. The Window bit in the TCP header (Check-in TCP header Image) determines the number of segments that can be sent simultaneously to avoid an irresistible destination. At the start of the session, the window is small, but it increases over time.
The destination host can also decrease the window to slow down the flow. Hence, the window is called the sliding window. When the source has finished the number of segments allowed by the window, it cannot send any further segments until an acknowledgement is received from the destination.
The figure below illustrates how the window increases during the session. Notice the Destination host increasing the Window from 800 to 1000 simultaneously when it sends an ACK back to the source. This process is called windowing.
Reliable Delivery with Error recovery
When the destination receives the last segment in the agreed window, it must send an acknowledgement to the source. It sets the ACK flag in the header, and the acknowledgement number is set to the sequence number of the next byte expected. If the destination does not receive a segment, it does not send an acknowledgement back. This tells the source that some segments have been lost, and it will re-transmit the segments.
The above figure illustrates how windowing and acknowledgement are used in the TCP process. Notice that when the source does not receive acknowledgement for the segment with sequence number 2000, it re-transmits the data. Once it receives the acknowledgement, it sends the next sequence according to the window size.
Ordered Delivery
TCP transmits data in the order received from the application layer and uses the sequence number to mark the order. The data may be received at the destination in the wrong order due to network conditions. Thus, TCP at the destination orders the data according to the sequence number before sending it to the application layer at its end. This order delivery is part of TCP’s benefit and one of the purposes of the Sequence Number.
Connection Termination
When all data has been successfully transferred, the source initiates a four-way handshake to close the session. To close the session, the FIN and ACK flags are used. FIN and ACK will be discussed in the coming articles.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.