TCP: Transmission Control Protocol

Connection-oriented

In contrast to UDP, TCP represents a connection-oriented transmission. This means that an explicit connection between two nodes must be established before the actual data transmission. The two nodes are each identified using the IP address and port number.

Connection establishment

The connection is established using a three-way handshake, or in other words, in three steps. The node that wants to establish the connection first transmits a segment containing a set SYN flag. The SYN flag signals the sender's desire to establish a connection with the receiver.

Besides the SYN flag, a separate sequence number, the window field, and optional additional parameters are transmitted in the first segment. The sequence number is composed of a randomly generated number, the ISN (Initial Sequence Number), and a consecutive number. The additional consecutive number of the segment indicates the position of the currently sent byte in the overall data stream. As a result, the order of all segments is known and the data stream can be reassembled later by the receiver.

The window field gives information about the available memory of the node. This ensures that a sender does not send more data to the receiver than its available memory allows. Because communication can be bidirectional, both nodes communicate their available memory to the opposite node.

In the second step, the original receiver sends a SYN ACK. The segment has both a set SYN flag and a set ACK flag. As a result, this node signals the original sender that it has received the request to establish a connection and acknowledges positively. The node also sends its own sequence number. Both nodes now clearly know their opposite node, and all future exchanged segments can be associated with the corresponding sender.

The third and last step for establishing the connection includes an acknowledgment that the original sender transmits. It uses this to signal the opposite node that the connection has been successfully established. Starting from now, data can be exchanged between the two nodes.

Data transmission

Because TCP always requires an explicit connection between two nodes, the sending of Broadcast or Multicast messages to the network without a specific receiver is not possible. Reliable data transmission can take place only through the explicit connection. Various mechanisms ensure that the data arrive at the receiver and have not been corrupted.

The CRC checksum protects the data of the segment from corruption during transmission. The previously-mentioned sequence number ensures that the order of the segment is known even if earlier segments arrive at the receiver later.

The ACK number is used to acknowledge the receipt of each segment to the sender; provided no errors were detected. The acknowledgment is made by sending a segment with a set ACK flag. This signals that the segment has a valid acknowledgment number. The sender then interprets the ACK number in the segment. It provides information about the segment whose receipt is being positively acknowledged. Each segment also contains updated information about available memory in the window field, so that a sender is always informed about how much data it can currently send to the receiver.

If the sender does not receive a positive acknowledgment within a defined time period, the segment will be sent again because this means that the segment is faulty or did not reach the receiver. The time period is referred to as the Retransmission Timer, which exists for each segment and is individually counted down. After receipt of a positive acknowledgment, the corresponding timer for this segment is cleared.

Connection release

When all data have been exchanged and positively acknowledged, a connection can be closed. To do so, a node sends a segment with set FIN flag, which signals the connection termination. The receiver of this FIN segment must respond with an acknowledgment so that the connection is half-closed. If this node would also like to terminate the connection, it sends a segment with a set FIN flag to the original sender. If this is also acknowledged, the connection termination is complete. Data can no longer be transmitted.

Last modified: Tuesday, 24 April 2018, 3:33 PM