本地主机上 UDP 的可靠性
我知道 UDP 本质上是不可靠的,但是当连接到本地主机时,我希望内核以不同的方式处理连接,因为一切都可以在内部处理。那么在这种特殊情况下,UDP 是否被认为是可靠的协议,或者如果缓冲区溢出,内核是否仍然可能会丢弃某些数据包?
I know that UDP is inherently unreliable, but when connecting to localhost I would expect the kernel handles the connection differently since everything can be handled internally. So in this special case, is UDP considered a reliable protocol, or will the kernel still potentially junk some packets if buffers are overrun?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我看到 UDP 到 localhost 丢包。我们认为内核队列超载了。我们唯一确定的是它正在丢包。
I have seen UDP to localhost dropping packets. We think we were overloading the kernel queue. All we know for sure is that it was dropping packets.
我重复之前对相关问题的回答。为了保持可移植性,请始终预期您的 UDP 套接字可能会丢弃数据包或接收无序数据。
I repeat a previous answer to a related question. To remain portable always anticipate your UDP sockets might drop packets or receive out of order data.
我认为 UDP(或任何其他网络协议)没有说明连接到本地主机时的不同行为。所以答案将取决于您使用的特定内核。最好假设 UDP 的行为与 UDP 类似。
I don't think that UDP (or any other network protocol) says anything about different behavior when connecting to localhost. So the answer will depend on the specific kernel that you're using. Best to assume that UDP will behave like UDP.