0

我知道什么 TCP 实现了按顺序数据传输,但它实际上是否验证了从 A 到达 B 的数据是从 A 发送的实际数据?如果确实如此,它究竟是如何发生的?

4

2 回答 2

1

它实际上是否验证了从 A 到达 B 的数据是从 A 发送的实际数据?

坦率地说,没有。它试图确保接收者在会话期间获得相同数量的发送者发送的字节数(使用 ack 和 syn 号)。它还确保每个段都有正确的校验和,我认为这并不能保证太多。如果您的主机内存有问题,则可能是您发送了一个字节流,然后,一些缓冲区稍后再使用另一个字节流(由于位抖动)来计算校验和。校验和将是正确的,但发送和接收的消息会有所不同。如果您想要可靠性,请始终实现您自己的应用程序级消息的校验和/散列/签名。

一些相关阅读解释了单个位错误的成本: http: //status.aws.amazon.com/s3-20080720.html

于 2013-06-30T10:28:08.417 回答
0

我相信来自RFC 793的这个 excert回答了你的问题:

The TCP must recover from data that is damaged, lost, duplicated, or
delivered out of order by the internet communication system.  This
is achieved by assigning a sequence number to each octet
transmitted, and requiring a positive acknowledgment (ACK) from the
receiving TCP.  If the ACK is not received within a timeout
interval, the data is retransmitted.  At the receiver, the sequence
numbers are used to correctly order segments that may be received
out of order and to eliminate duplicates.  Damage is handled by
adding a checksum to each segment transmitted, checking it at the
receiver, and discarding damaged segments.
于 2013-06-12T19:26:04.070 回答