TCP (Transmission Control Protocol) is a network protocol that transfers your data over the internet from your device to a web server. You use the TCP protocol whenever you chat to your friends on Skype, send emails, watch online videos, or simply browse the web.
TCP is connection-based, so it establishes a connection between the receiver and sender and maintains it while transferring data. It guarantees that the data arrives completely intact. Because of its reliability, TCP is the most popular network protocol.
Structure (20 字节~)
- Source Port
- Destination Port
- SEQ Num: a number used to track the order of the packets being transmitted (random)
- ACK Num: a number used to confirm the receipt of packets
- TCP Header Length (aka offset): the length of the TCP header in 32-bit words (because of optional contents)
- Flags (SYN, ACK, FIN): various 1-bit flags that indicate the packet’s purpose
- URG 32
- ACK (acknowledge receipt) 16
- PSH: the incoming data should be passed on directly to the application instead of getting buffered 8
- RST 4
- SYN (synchronize sequence numbers) 2
- FIN (finish transmitting data) 1
- Window size: the maximum amount of data that the receiving device is willing to accept in a single packet
- Checksum: a value used to verify the integrity of the packet
- Payload
SYN + ACK 保证被拆分的数据包,最终在接收端可以被拼接成完整的数据。
The sliding window
解决了来自发送方的数据背压
The routes of a packet
Questions
Commands
|
|
other interesting topics
HOL blocking
The TCP Head-of-Line (HOL) blocking problem occurs when packets are received out of order at the destination, causing a delay in processing subsequent packets even though they might have arrived.
impacts of HOL blocking
- increased latency
- reduced throughput
- more resource utilization
mitigation strategies
- tcp fast retransmit and recovery
- selective acknowledgement
- multipath tcp