Are UDP Packets dropped when UDP header checksum is incorrect?

我是研究僧i 提交于 2021-02-04 17:52:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!