- port number — connection, socket pair
- sequence number — 放資料欄位第一位元組的序號。連線建立時,會送 SYN 封包 (SYN flag 打開,沒有資料欄位),序號欄位放一個任意選用的初始序號 (ISN,initial sequence number),之後資料的每個位元組的序號就是從 ISN +1 開始算。
- acknowledgment number — ACK flag 打開時才有效,代表尚未收到的序號。acknowledgment 不增加封包長度,所以通常連線建立後,ACK flag 會一直打開。
- header length — 32-bit word 大小。一般 TCP header 是 20-byte,但 option 欄位大小不是固定的。
- flag
- URG — the urgent pointer is valid
- ACK — the acknowledgment number is valid
- PSH — the receiver should pass this data to the application as soon as possible
- RST — reset the connection
- SYN — synchronize sequence numbers to initiate a connection.
- FIN — the sender is finished sending data
- window size — 還可以收多少位元組 (從 acknowledgment number 算起)。
- checksum — for a TCP segment
- option
RFC 2018 - TCP Selective Acknowledgment Options
TCP 將 window size 的資料分成數個 segment 來送,但中間有數個 segment 遺失時,一次來回的時間只能知道第一個遺失的 segment,如果其它遺失的 segment 等到確定後才重送,效能可能會大打折扣。較 aggressive 的方式可以提早重送接下來的全部 segment,但又有可能許多重送的 segment 本來就已經成功送達。
A Selective Acknowledgment (SACK) mechanism, combined with a selective repeat retransmission policy, can help to overcome these limitations. The receiving TCP sends back SACK packets to the sender informing the sender of data that has been received. The sender can then retransmit only the missing data segments.