问题
If i open a raw socket, and send udp packets with a wrong checksum, would the packets be dropped other side by the tcp/ip stack?
回答1:
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
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.
回答2:
If comes packet with wrong checksum, OS will drop it before passing it to the socket.
Destination application cannot determine if packet was lost or comes with wrong checksum. I think that it also cannot force else behavior.
来源:https://stackoverflow.com/questions/18452716/are-udp-packets-dropped-when-udp-header-checksum-is-incorrect