TCP
The conceptHow a web page arrives whole when the internet drops packets
IP only tries its best: packets get lost, damaged or reordered. TCP (Transmission Control Protocol) runs on both computers on top of IP and turns that into a reliable byte stream: the app gets exactly what was sent, in order.
Each byte gets a sequence number, and the receiver sends acknowledgements (ACKs) naming the next byte it expects. A three-way handshake first swaps starting numbers: SYN ("mine start at X"), SYN-ACK ("mine at Y"), ACK.
What it’s forTells the sender how much of its stream has safely arrived.
ACK = seq + len
- seq
- sequence number of the first byte in the segment (one TCP packet)
- len
- how many bytes of data the segment carries, e.g. 1000
- ACK
- the next byte number the receiver expects; everything before it has arrived
What it givesA single number that confirms every byte up to it, so one ACK covers many segments.
- Segment starts at byte 1001 and carries 1000 bytes
- ACK = 1001 + 1000 = 2001
- Receiver says: bytes up to 2000 are here, send 2001 next