Reputation:
I know what TCP implements in-order data transmission,but does it actually validates the data that arrived from A to B is the actual data that was sent from A ? If it does , how exactly does it happen?
Upvotes: 0
Views: 84
Reputation: 71
does it actually validates the data that arrived from A to B is the actual data that was sent from A ?
Frankly, no. It tries to make sure receiver gets the same number of bytes sender sent during session (using ack and syn numbers). It also makes sure every segment has correct checksum, which, I think doesn't guarantee much. If your host has faulty memory, it could be that you send one stream of bytes, then, a few buffers later some another stream of bytes (due to bit-flapping) is used to calculate checksum. The checksum will be correct, but the sent and received messages will differ. If you want reliability, always implement your own checksumming/hashing/signing of application-level messages.
Some relevant reading explaining a cost of a single bit error: http://status.aws.amazon.com/s3-20080720.html.
Upvotes: 1
Reputation: 28366
I believe this excert from RFC 793 answers your question:
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.
Upvotes: 0