TCP - Transmission Control Protocol

TCP is a connection oriented, reliable transmission protocol. It has the following features:

This is what a TCP packet looks like. It contains the following data:

When a computer wants to send data using TCP, it needs to start a connection. It does this using what is called a 3 way handshake:

[1] The initiating connection(client) first sends a SYN packet with an initial packet number

[2] The receiving end(server) sends a packet with the SYN and ACK flags set where the acknowledgement number of this packet is the sequence number of the packet sent by the client. The server sets its own sequence number

[3] The client receives this packet and sends a new packet with the ACK flag set and the acknowledgement number set as the initial sequence number sent by the server

After the 3rd packet, the client and server begin transferring data.TCP also has a handshake to tear down a connection but this isn’t relevant for now.