Connection-Oriented Communication (COC) was briefly discussed in Part 5, hopefully this will be a little more in-depth. COC is a data communication mode, in which we must first establish a connection to either the remote host or server prior to any sending of data; otherwise, the possibility of data loss increases. The process of establishing a connection-oriented session to a remote peer host is called a three-way handshake.
An end-to-end logical circuit is created for the sole purpose of transmitting the data, when transfer is finished the link/connection is terminated.
The establishment of the TCP connection can be summed up as follows:
- Host A needs to initialize a connection (or a “connection agreement) sends out a SYN (Synchronize) packet with proposed initial sequence number to the destination host B;
- When the host B receives SYN message, it returns a packet with both SYN and ACK packets set in the TCP header (SYN-ACK);
- When the host A receives the SYN-ACK, it sends back ACK (Acknowledgment) packet;
- Host B receives ACK and at this stage the connection is ESTABLISHED.
The connection-oriented protocol sends out acknowledgement (ACK) packets after a successful delivery. After data packet is transmitted, the sending host waits for acknowledgement from receiver; if time expires, it is assumed that the data was not received and is then retransmitted.
When the data packet transmission is completed and the host wants to terminate the connection, a termination process is initiated. The TCP connection termination is a four-step process:
- Host A, terminates the connection, sends a special message with the FIN (finish) flag, indicating that it has finished sending the data;
- Host B, receives the FIN segment, does not terminate the connection but enters into a “passive close” (CLOSE_WAIT) state and sends the ACK for the FIN back to the host A. Now the host B enters into LAST_ACK state. At this point host B will no longer accept data from host A, but can continue transmit data to host A. If host B does not have any data to transmit to the host A it will also terminate the connection by sending FIN segment;
- Host A receives the last ACK from the host B, it enters into a (TIME_WAIT) state, and sends an ACK back to the host B;
- Host B gets the ACK from the host A and closes the connection.
Transmission of segments needs flow control to ensure the efficient flow of data. Due to the fact that there are differing types of flow control (buffering, windowing, and congestion avoidance), windowing will be used to aid in data transmission efficiency. Windowing aids by controlling how many windows are opened at any given time. If the data flows too quickly (i.e., there are too many windows open) then there will be data loss and datagrams dropped, which require retransmission of the data. If there are too few windows open then the transmission would be slow, sluggish and inefficient.
Host A starts transmit with window size of 1000, one 1000byte frame is transmitted. Host B returns ACK with window size to increase to 2000. The host A receives ACK and transmits two frames (1000 bytes each). Then the receiver advertises an initial window size to 2500. Now sender transmits three frames (two containing 1,000 bytes and one containing 500 bytes) and waits for an acknowledgement. The first three segments fill the receiver’s buffer faster than the receiving application can process the data, so the advertised window size reaches zero indicating that it is necessary to wait before further transmission is possible.
The size of the window and how fast to increase or decrease the window size is available in various TCP congestion avoidance algorithms.
ptgmedia.pearsoncmg.com/ images/ 0130424110/ samplechapter/ 0130424110_ch18.pdf
Lammle, T. (2007). CCNA Cisco Certified Network Associate Study Guide. Indianapolis: Wiley Publishing, Inc.