[ACCEPTED]-Can UDP data be delivered corrupted?-udp

Accepted answer
Score: 22

UDP packets use a 16 bit checksum. It is 4 not impossible for UDP packets to have corruption, but 3 it's pretty unlikely. In any case it is 2 not more susceptible to corruption than 1 TCP.

Score: 19

First of all, the "IP checksum" referenced 12 above is only an IP header checksum. It 11 does not protect the payload. See RFC 791

Secondly, UDP 10 allows transport with NO checksum, which 9 means that the 16-bit checksum is set to 8 0 (ie, none). See RFC 768. (An all zero 7 transmitted checksum value means that 6 the transmitter generated no checksum)

Thirdly, as 5 others have mentioned, UDP has a 16-bit 4 checkSUM, which is not the best way to detect 3 a multi-bit error, but is not bad. It is 2 certainly possible for an undetected error 1 to sneak in, but very unlikely.

Score: 6

Possible? Absolutely. Undetected? Unlikely, since 5 UDP employs a checksum that would require 4 multiple-bit errors to appear valid. If 3 an error is detected, the system will likely 2 drop the packet - such are the risks of 1 using UDP.

Score: 5

UDP packets can also be delivered out of 3 order, so if you are devising a protocol 2 on top of UDP you have to take that into 1 account as well.

Score: 3

A common form of "corruption" that affects 4 unsuspecting programmers is datagram truncation. See "Unix 3 Network Programming" by Stevens for more 2 information (page 539 in 2nd ed.)

You might 1 check the MSG_TRUNC flag...

Score: 1

Short answer: YES.

Detailed answer:

About 15 7 years ago(maybe 2011?) We found that UDP 14 datagrams are unintentionally changed when 13 a UDP datagram is exchanged between a computer 12 in China and another one in Korea. Of course, Checksum 11 in UDP packet header is also reculculated 10 regarding to the payload change. There were 9 no malware software in two computers.

We 8 found that the unintentional change only 7 occurs when these conditions match:

  • First several bytes of datagrams are similar to the previous datagram
  • Only occurse when UDP datagrams go from one nation to another

I don't 6 the cause exactly, but I roughly guess it 5 is China Golden Shield.

So we added datagram garbling algorithm 4 into out software ProudNet and the problem 3 went away. It is not difficult to implement. Just 2 encode or obfuscate first several bytes 1 of your datagram.

More Related questions