Transmission Control Protocol (TCP) is a transport layer protocol used to create a connection between applications so that they can exchange data over a communication network.
TCP provides a process for communication. Port numbers are appended in the header of the packet to enable this.
A three-way handshaking process takes place to open a connection in TCP; hence, it is called a connection-oriented protocol.
A packet (called a segment in case of TCP) contains a checksum field used for error control.
TCP prevents the sender from sending in more data than the receiver can handle with the window size provided by the receiver.
It guarantees the reliable delivery of segments. Incase of segment loss or corruption, segments are re-transmitted.
It reassembles the packets in the correct order at the receiver side.
It uses a congestion avoidance algorithm to avoid the network from being congested.
The TCP segment consists of a header and data. The following illustration goes over its structure:
TCP is used where reliable in-order delivery of packets is needed. Such applications include:
Web surfing
Sending and receiving emails