简体   繁体   English

难以理解Wireshark中的数据包

[英]Trouble understanding packets in wireshark

Does the sequence number for the next packet get the ack nr plus the length? 下一个数据包的序列号是否得到ack nr加上长度?

OR 要么

Does the sequence number for the next packet gets the seq nr plus the length of the previous 下一个数据包的序列号是否获得seq nr加上前一个的长度

AND

Can the packets be in random order? 数据包可以按随机顺序排列吗? and if so why and how do we know a packet has been lost? 如果可以,为什么以及如何知道一个数据包丢失了?

First, there are two sets of sequence and acknowledgement number pairs, one set for each side of the conversation. 首先,有两组序列号和确认号对,一组用于对话的每一侧。 The sequence number is the sender's current number and the acknowledgement number is the receiver's idea of the "next expected sequence number" from the sender. 序列号是发送者的当前号码,确认号是接收者对发送者的“下一个预期序列号”的想法。 Generally, they work like this ... 通常,他们像这样工作...

Assumptions: HostA's initial sequence number is 100, HostB's initial sequence number is 200 (These numbers are random and their starting values don't matter at all, but they are established during the TCP 3-way handshake.) 假设:HostA的初始序列号是100,HostB的初始序列号是200(这些数字是随机的,并且它们的起始值完全无关紧要,但是它们是在TCP 3向握手期间建立的。)

Scenario: HostA sends 1000 bytes of TCP payload to HostB: 方案:HostA向HostB发送1000字节的TCP有效负载:

Seq #  Ack #  TCP Payload (bytes)  Next Seq #
-----  -----  -------------------  ----------
100    200                   1000        1100

Here, the HostA's initial sequence number is assumed to be 100 and since we're assuming it is sending 1000 bytes of TCP payload, we calculate the next expected sequence number to be 100 + 1000 = 1100. That's the ACK # we're looking for from HostB, which would indicate to HostA that HostB received all 1000 bytes of payload and is expecting the next TCP segment from HostA to have a sequence number of 1100. 在这里,假设HostA的初始序列号为100,并且由于我们假设它正在发送1000字节的TCP有效负载,因此我们计算出下一个预期的序列号为100 + 1000 =1100。这就是我们要查找的ACK#从HostB发送,这将向HostA指示HostB接收了所有1000字节的有效负载,并且期望HostA的下一个TCP段的序列号为1100。

HostB acknowledges the reception of the above TCP segment from HostA: HostB确认已从HostA接收到上述TCP段:

Seq #  Ack #  TCP Payload (bytes)  Next Seq #
-----  -----  -------------------  ----------
200    1100                     0         200

This is HostB's set of sequence and acknowledgement numbers. 这是HostB的序列号和确认号。 Note that this set is completely independent of HostA's set. 请注意,此集合完全独立于HostA的集合。 Here, HostB has acknowledged to HostA the reception of all 1000 bytes of data that the sender sent in the previous packet by sending HostA an ACK # of 1100 (initial sequence number of 100 plus the additional 1000 bytes of payload). 在此,HostB已通过向HostA发送1100的ACK#(初始序列号100加上有效载荷的另外1000字节)向HostA确认发送方在前一个数据包中发送的所有1000字节数据的接收。 HostB's own sequence number of 200 does not play a role in this transfer of data except to indicate to HostA that no data has been sent by HostB in the reverse direction back to HostA. HostB自己的序列号200在此数据传输中不起作用,只是向HostA指示HostB没有反向发送回HostA的数据。

If HostB did NOT receive this segment from HostA, the ACK HostB would eventually send back to HostA would have carried the ACK # of only 100, so HostA would know that HostB did not receive the segment carrying 1000 bytes of payload and should therefore retransmit it. 如果主机B 没有收到主机A本段的ACK主机B最终会送回主机A会已经进行的只有100的ACK#,所以主机A就知道主机B不接收携带1000个字节的有效载荷的部分,因此应重新发送它。

I hope that helps? 我希望有帮助吗?

For further information and more details, refer to RFC 793 . 有关更多信息和更多详细信息,请参阅RFC 793

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM