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;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值