c++socketsnetwork-programmingudp

Are UDP packets dropped when UDP header checksum is incorrect?


If I open a raw socket, and send UDP packets with a wrong checksum, would the packets be dropped at the other side by the TCP/IP stack?


Solution

  • Yes they would be dropped. If you need more reliable communication you're much better off using TCP.

    For more information, take a look at this: http://www.diffen.com/difference/TCP_vs_UDP

    In UDP there's no guarantee that the packets will even be sent, let alone received. If they are in fact received though, they are checked. If they fail checksum they are dropped.

    EDIT: also to add to that, UDP does not by default order the packets as they are sent, that has to be done at the application level. Bear this in mind if you still intend on using UDP.