Transmission Control Protocol (TCP)

Transmission Control Protocol (TCP)

A Simple Guide to the Working of Transmission Control Protocol

In this modern Internet era, Reliable communication is essential. However, when data travels through the internet, various factors can affect it, leading to loss or corruption.

The Transmission Control Protocol (TCP) addresses these issues effectively. In this article, we will explore the challenges associated with packets, the TCP protocol, the functioning of the three-way handshake, and its significance for reliable and efficient data transmission.

The issues associated with packets

When we send information over the internet, it passes through the seven layers of the OSI model. Among these layers is the network layer, which utilizes the Internet Protocol to split the raw data into packets, assign an IP address, and route the packets along the most efficient path available.

However, during data transmission, packets may arrive out of order because two packets can follow different routes to the destination. Similarly, packets can become corrupted for various reasons, causing the received data to no longer match the original data. Packets may also be lost in the physical layer during transmission.

The Transmission Control Protocol (TCP) is used on top of IP to ensure the reliable transmission of packets. TCP includes mechanisms to address the issues discussed above.

Transmission Control Protocol (TCP)

The Transmission Control Protocol ensures reliable and efficient data transmission over the Internet, guaranteeing that the information is delivered accurately and in the correct format.
The Internet Protocol responsible for packetizing data, works closely with TCP. This is why it is sometimes referred to as TCP/IP.

TCP Ensures

  • Reliability: Ensures that all packets are delivered correctly.

  • Ordered Delivery: Ensures that all packets are reassembled in the correct sequence.

  • Error Checking: Detects corrupted or missing packets and retransmits them as needed.

TCP is crucial for applications that require accuracy and reliability, such as email, web browsing, and file transfer.

How Transmission Control Protocol Works

Let's explore the process of transmitting a packet with TCP

  1. Connection Establishment / Three-way Handshake:

    TCP starts by creating a reliable connection between the sender and receiver using a three-step process, known as the three-way handshake.

    • SYN: The sender sends a synchronization (SYN) request to the receiver to start the communication.

    • SYN-ACK: The receiver acknowledges (ACK) the request and sends its synchronization (SYN).

    • ACK : The sender acknowledges the receiver's SYN-ACK, After this handshake, the connection is established.

  1. Connection Termination

    Once the request is completed, TCP uses a four-step process to terminate the connection.

    • FIN from Sender: The sender sends a FIN flag to inform the receiver no more data to send.

    • ACK from Receiver: The receiver acknowledges the FIN by sending ACK back to the sender.

    • FIN from Receiver: The Receiver sends a FIN flag to inform the sender no more data to send, Ready to close the connection.

    • ACK from Sender: The sender Acknowledges the receiver’s FIN by sending the final ACK.

Key features of TCP

  • Segment Numbering System:
    TCP keeps track of the sequence of the segments transmitted or received, and it assigns a sequence number to each one.

  • Connection Oriented:

    It means the sender and receiver remain connected until the completion of the process. i.e. order remains the same before and after transmission.

  • Full Duplex: In TCP, data can travel from the sender to the receiver and vice versa at the same instance of time.

  • Flow Control: TCP uses a mechanism called windowing to ensure the sender doesn’t overwhelm the receiver.

  • Error Control: TCP implements an error control mechanism for reliable data transfer. Segments are checked for error detection. Error Control includes – Corrupted Segment & Lost Segment Management, Out-of-order segments, Duplicate segments, etc.

Conclusion

Although TCP provides reliability through acknowledgment, error checking, and sequence maintenance, it can add overhead that slows down data transmission. For tasks like web browsing and file transfers, where data integrity is crucial, TCP is an excellent option. However, for real-time applications such as gaming or live video calls, where speed is more important than reliability, I prefer using protocols like UDP.