Transmission Control Protocol

The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite . It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonly referred to as TCP/IP. TCP provides reliable, ordered, and error-checked delivery of a stream of octets (bytes) between applications running on hosts communicating via an IP network.

TCP is connection-oriented communication , and a connection between client and server is established before data can be sent.

Source

Transmission Control Protocol

TCP Segment #

Protocol operation #

Connection establishment #

TCP 3-way handshake

Before transmission sending and receiving devices must acknowledge each other’s presence and readiness to send and receive data.

  1. SYN: The active open is performed by the client sending a SYN to the server. The client sets the segment’s sequence number to a random value A.
  2. SYN-ACK: In response, the server replies with SYN-ACK. The acknowledgement number is set to one more than the received sequence number i.e. A+1, and the sequence number that the server chooses for the packet is another random number, B.
  3. ACK: Finally, the client sends an ACK back to the server. The sequence number is set to the received acknowledgment value i.e. A+1, and the acknowledgment number is set to one more than the received sequence number i.e. B+1.

Note: Steps 1 & 2 establish and acknowledge the sequence number for one direction. Steps 2 & 3 establish and acknowledge the sequence number for the other direction. Following the completion of these steps, both the client and server have received acknowledgements anda full-duplex communication is established.

Source

Connection termination #

Once transmission is complete - Sending device: FIN Receiving device: ACK, FIN Sending device: ACK

TCP Header #