To establish a connection TCP uses a three-way handshake. Before a client attempts to connect with a server, the server must first bind to and listen at a port to open it up for communications. This is called the passive open. Once the passive open is established a client may initiate an active open to establish a connection the three-way or three-step handshake occurs.
- Step 1: Active open is performed by the client sending a SYN to the server. The client sets the segment sequence number to a random value.
- Step 2: The second is SYN-ACK. In response the server replies with a SYN-ACK. The acknowledgement number is set to one more than the received sequence number and the sequence number that the server chooses for the packet is another random number.
- Step 3: The final response back from the client is an ACK. The client sends an ACK back to the server. The acknowledgement number is set to one more than the received sequence number. At this point both client and server receive an acknowledgement of the connection.
In steps one and two we establish the connection parameter for one direction and it is acknowledged.
In steps two and three we establish the connection parameter for the other direction and it is acknowledged. With these a full duplex communication is established.
TCP uses Windows and flow control:
Data often is too large to be sent in a single segment. So TCP splits the data into multiple segments.
TCP provides flow control through “windowing” to set the pace on how much data is sent at a time or how many bytes per window and how many windows between acknowledgments. The window size determines the amount of data that you can transmit before receiving an acknowledgement. This is how TCP assists in congestion control. There is a sliding window and that refers to the fact that the window size is negotiated dynamically during the session which means it can shrink and it can grow asking for more or less data at a time.
An expectational acknowledgement means that the acknowledgement number refers to the octet that is next expected. If the source receives no acknowledgement it knows to re transmit at a slower rate.
It’s similar to if one host said: “is this fast enough for you?” and the second host said: “No, I didn’t get that slow down or reduce your window size. So in review TCP establishes connections with a three-way handshake uses sequence numbers and it is reliable by the use of acknowledgments. Please join me for the next lesson examining the operation of UDP