·TCP报文详解

本文详细介绍了TCP报文的各个字段,包括源端口、目的端口、序号、确认序号、数据偏移、标志位(如URG、ACK、PSH、RST、SYN、FIN)、窗口大小、校验和、紧急指针以及选项和填充。这些内容对于理解TCP连接的建立、数据传输和断开至关重要。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、TCP报头详解:

1、源端口:16位,标识源端口号;


2、目的端口:16位,标识目的端口号;


3、序号:32位,随机生成,每发送一次数据,该序号+1后发送给对方;


4、确认序号:32位,确认的是序号,即下一次自己应该收到的数据的序列号。接收端收到确认应答后,表明这个序列号以前的数据都被正常接收;


5、数据偏移(首部长度):4位,由于首部可能含有选项和填充项内容,因此TCP的报头长度是不确定的。报头不包含任何选项字段长度为20 字节。4位的数据偏移字段,可以表示的最大值1111,转换成10进制=15(即头部15行,每行32位),15*32/8=60,报头包含可选选项时最大长度为60字节


6、保留位:6位,保留为了以后使用,一般置0,即使收到的包中该字段不为0也不丢弃;


7、标志位:6位,共六个标志位。

(1)URG:紧急指针标志,为1时紧急指针有效,表明该包中有紧急需要处理的数据;为0忽略;

(2)ACK:确认序号标志,为1时确认号有效;为0时表示该包中不含确认信息,忽略确认号字段;

(3)PSH:push标志,为1表示是带有push标志的数据,指示接收方在收到该报文段以后,应尽快将这个报

Contents 3-1 Introduction........................................................................................................................................................ 3 3-2 Scope.................................................................................................................................................................. 3 3-3 CIP packets over TCP/IP ................................................................................................................................... 3 3-3.1 Unconnected messages .............................................................................................................................. 3 3-3.2 CIP transport class 0 and class 1 connections ............................................................................................ 5 3-3.2.1 CIP transport class 0 and class 1 packets ............................................................................................... 5 3-3.2.2 Behavior of class 0 and class 1 connections (informative) .................................................................... 5 3-3.3 CIP Transport class 2 and class 3 connections ........................................................................................... 6 3-3.4 CIP Transport classes 4 through 6 ............................................................................................................. 6 3-4 Connection Manager object ............................................................................................................................... 6 3-4.1 Connection parameters............................................................................................................................... 6 3-4.2 Connection type ......................................................................................................................................... 7 3-4.3 Priority ....................................................................................................................................................... 7 3-4.4 Trigger Type .............................................................................................................................................. 7 3-4.5 Connection size .......................................................................................................................................... 7 3-4.6 Connection request time-out ...................................................................................................................... 7 3-4.7 Connection path ......................................................................................................................................... 7 3-4.7.1 Network connection ID .......................................................................................................................... 8 3-4.8 Forward_open for CIP transport class 2 and class 3 connections ............................................................ 11 3-4.9 Forward_open for CIP transport class 0 and class 1 connections ............................................................ 11 3-4.9.1 General ................................................................................................................................................. 11 3-4.9.2 Mapping connections to IP multicast addresses ................................................................................... 11 3-4.9.3 Completing the multicast connection (informative) ............................................................................. 12 3-5 CIP transport class 0 and class 1 connected data ............................................................................................. 12 3-5.1 UDP datagrams ........................................................................................................................................ 12 3-5.2 CIP transport class 0 and class 1 packet ordering .................................................................................... 12 3-5.3 Screening incoming connected data ......................................................................................................... 13 3-6 IP multicast scoping and address allocation..................................................................................................... 13 3-6.1 Background (informative) ........................................................................................................................ 13 3-6.1.1 General ................................................................................................................................................. 13 3-6.1.2 Current scoping practices ..................................................................................................................... 14 3-6.1.3 Current address allocation practices..................................................................................................... 14 3-6.1.4 Evolving Internet standards.................................................................................................................. 14 3-6.2 Interim scoping strategy ........................................................................................................................... 15 3-6.3 Interim allocation strategy........................................................................................................................ 15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值