TCP is a transport-layer protocol that exposes a reliable communication channel between two processes on top of IP. TCP guarantees that a stream of bytes arrive in order, without gaps, duplication, or corruption. It also implements a set of stability patterns to avoid overwhelming the network or receiver.
TCP partitions a byte stream into discrete packets called segments, which are sequentially numbered, so the receiver to detect holes & dupes.
Each segment sent needs to be acknowledged (ACK) by the receiver. If it doesn’t then a timer fires on the sending side, and the segment is retransmitted.
To verify if the data is corrupted, the receiver uses a checksum to verify the integrity of a delivered segment.
A connection needs to be opened before any data can be transmit- ted on a TCP channel. The state of the connection is managed by the operating system on both ends through a socket. The socket keeps track of the state changes of the connection during its life- time.
There are 3 states the connection can be in (simplified):
TCP uses a 3-way handshake to create a new connection:
The handshake introduces a full round-trip in which no application data is sent. Until the connection has been opened, it’s bandwidth is 0. The lower the round trip is, the faster the connection can be established. Putting servers closed to the clients & reusing connections helps reduce this cold-start penalty.

Flow control is a backoff mechanism implemented to prevent the sender from overwhelming the receiver.
The receiver stores incoming TCP segments waiting to be processed into a receive buffer. The receiver also communications back to the sender the size of the buffer whenever it acknowledges a segment. The sender, if it is respecting the protocol, avoids sending more data that can fit in the receiver’s buffer. (
Not too dissimilar to rate-limiting at the service lvl, but rather than rate-limiting on an API key or IP address, TCP is rate-limiting on a connection level.

