转载:TCP包结构解析
转自:https://blog.csdn.net/caotuo_csdn/article/details/90106916
* TCP包结构
* 以下是通过Wireshark抓到的一个包,依次是物理层、链路层、IP、TCP,下面主要分析TCP层的含义。
Frame 697: 1506 bytes on wire (12048 bits), 1506 bytes captured (12048 bits) on interface 0
Ethernet II, Src: Tp-LinkT_78:7b:ef (20:6b:e7:78:7b:ef), Dst: AsustekC_c1:86:97 (74:d0:2b:c1:86:97)
Internet Protocol Version 4, Src: static.172.64.69.159.clients.your-server.de (159.69.64.172), Dst: 192.168.0.106 (192.168.0.106)
Transmission Control Protocol, Src Port: http (80), Dst Port: 60575 (60575), Seq: 624361, Ack: 1, Len: 1452
Source Port: http (80) //源端口号
Destination Port: 60575 (60575) //目的端口号
[Stream index: 0]
[TCP Segment Len: 1452]
Sequence number: 624361 (relative sequence number) //32位序列号
[Next sequence number: 625813 (relative sequence number)]
Acknowledgment number: 1 (relative ack number) //32位确认序列号,即发送端希望收到的序列号
0101 .... = Header Length: 20 bytes (5) //4位首部长度
Flags: 0x010 (ACK) //标志位 ACK置1
000. .... .... = Reserved: Not set //保留位
...0 .... .... = Nonce: Not set //新增的
.... 0... .... = Congestion Window Reduced (CWR): Not set //新增的
.... .0.. .... = ECN-Echo: Not set //新增的
.... ..0. .... = Urgent: Not set
.... ...1 .... = Acknowledgment: Set
.... .... 0... = Push: Not set
.... .... .0.. = Reset: Not set
.... .... ..0. = Syn: Not set
.... .... ...0 = Fin: Not set
[TCP Flags: ·······A····]
Window size value: 240 //16位窗口大小(用于接收方的流量控制)
[Calculated window size: 240]
[Window size scaling factor: -1 (unknown)]
Checksum: 0xacb5 [unverified] //16位检验和
[Checksum Status: Unverified]
Urgent pointer: 0 //16位紧急指针
[SEQ/ACK analysis]
[Bytes in flight: 4356]
[Bytes sent since last PSH flag: 622908]
[Timestamps]
[Time since first frame in this TCP stream: 3.239693000 seconds]
[Time since previous frame in this TCP stream: 0.000001000 seconds]
TCP payload (1452 bytes) //TCP有效载荷
* 标志位解释
URG—为1表示高优先级数据包,紧急指针字段有效。
ACK—为1表示确认号字段有效
PSH—为1表示是带有PUSH标志的数据,指示接收方应该尽快将这个报文段交给应用层而不用等待缓冲区装满。
RST—为1表示出现严重差错。可能需要重现创建TCP连接。还可以用于拒绝非法的报文段和拒绝连接请求。
SYN—为1表示这是连接请求或是连接接受请求,用于创建连接和使顺序号同步
FIN—为1表示发送方没有数据要传输了,要求释放连接。
————————————————
版权声明:本文为CSDN博主「caotuo_csdn」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/caotuo_csdn/article/details/90106916