TCP包結構簡介

TCP Header

這裏寫圖片描述

按照上圖BIT座標:

  • 0-0 至 0-15 發送方端口;
  • 0-16 至 0-31 接收方端口;
  • 32-0 至 32-31 sequence number,TCP序列號;!!!
  • 64-0 至 64-31 ack number,TCP確認號,爲TCP序列號+1;
  • 96-0 至 96-3 數據偏移量;
  • 96-4 至 96-6 預留位;
  • 96-7 至 96-15 FLAG 標誌位;
  • 96-16 至 96-31 緩衝區大小;
  • 128-0 至 128-15 校驗位;
  • 128-16 至 128-31 標識urgent data的位置;
  • 160-0 至 … 選項段;

TCP FLAG 標誌位

  1. NS (1 bit): ECN-nonce - concealment protection (experimental: see RFC 3540).
  2. CWR (1 bit): Congestion Window Reduced (CWR) flag is set by the sending host to indicate that it received a TCP segment with the ECE flag set and had responded in congestion control mechanism (added to header by RFC 3168).
  3. ECE (1 bit): ECN-Echo has a dual role, depending on the value of the SYN flag. It indicates:
    • If the SYN flag is set (1), that the TCP peer is ECN capable.
    • If the SYN flag is clear (0), that a packet with Congestion Experienced flag set (ECN=11) in IP header was received during normal transmission (added to header by RFC 3168). This serves as an indication of network congestion (or impending congestion) to the TCP sender.
  4. URG (1 bit): indicates that the Urgent pointer field is significant
  5. ACK (1 bit): indicates that the Acknowledgment field is significant. All packets after the initial SYN packet sent by the client should have this flag set.
  6. PSH (1 bit): Push function. Asks to push the buffered data to the receiving application.
  7. RST (1 bit): Reset the connection
  8. SYN (1 bit): Synchronize sequence numbers. Only the first packet sent from each end should have this flag set. Some other flags and fields change meaning based on this flag, and some are only valid for when it is set, and others when it is clear.
  9. FIN (1 bit): Last packet from sender.

標誌位對應的位置在上圖中BIT座標:96-7 至 96-15;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章