Sometimes in my networking library when I send a packet the data arrives different than when I sent it. I assumed that TCP guarenteed exact delivery. Is this true? Or must there be something wrong in the packaging and receiving process of my own library code?
Asked
Active
Viewed 67 times
-3
-
Why is this downvoted? Please explain. I have a simple question: Does TCP guarentee delivery of packets with exactly the same data as it has been sent? – tcpstar Sep 03 '18 at 09:10
-
2It's not guaranteed, but it is statistically likely that the data received is that data that was sent. I'd say it's far more likely your code is at fault, on the principle of [horses not zebras](https://en.wikipedia.org/wiki/Zebra_(medicine)). – womble Sep 03 '18 at 09:17
-
1Welcome! By philosophy and design votes are anonymous and **neither voting [up](http://serverfault.com/help/privileges/vote-up) nor voting [down](http://serverfault.com/help/privileges/vote-down) requires any mandatory explanation**. The tooltip that appears when your mouse pointer hoovers over the down button states: *"this question does not show any research effort; it is unclear or not useful"*. Also questions can attract a down vote when not [well written](http://meta.serverfault.com/a/3609/37681), not quite [on-topic](http://serverfault.com/help/on-topic) or missing details. – HBruijn Sep 03 '18 at 09:21
2 Answers
0
TCP does NOT guarantee exact delivery of your data at the level of an individual packet.
Instead TCP provides the framework to determine integrity of the data by including sequence numbers and checksums in the header of every packet, which the recipient should check and a mechanism where the recipient can request the sender to retransmit packets when packets don't arrive at all or the checksums fail.

HBruijn
- 77,029
- 24
- 135
- 201
0
Try to match the checksum. If it does not match it's likely that the data is being altered by something or someone after it's being sent and before it reaches the destination. Like an MITM thing. Its possible on both ends sender and receiver.

Zquest
- 19
- 9