是否会丢弃UDP数据包

是否会丢弃UDP数据包

本文介绍了UDP报头校验和不正确时,是否会丢弃UDP数据包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我打开一个原始套接字,并发送带有错误校验和的udp数据包,这些数据包是否会被tcp/ip堆栈丢弃到另一侧?

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?

推荐答案

是的,它们将被删除.如果您需要更可靠的通信,那么使用TCP会更好.

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

有关更多信息,请查看以下内容: http://www.diffen.com/difference/TCP_vs_UDP

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

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.

还要补充一点,默认情况下,udp不会按发送顺序对数据包进行排序,而必须在应用程序级别进行.如果您仍打算使用UDP,请记住这一点.

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.

这篇关于UDP报头校验和不正确时,是否会丢弃UDP数据包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 05:07