我应该使用(非阻塞)NIO用于UDP吗? [英] Should I use (non-blocking) NIO for UDP?

查看:650
本文介绍了我应该使用(非阻塞)NIO用于UDP吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据这篇文章, UDP只是不阻止。使用(非阻塞)NIO API进行UDP是否有任何优势?或者我应该使用更简单的传统io API吗?

According to this post, UDP just doesn't block. Are there any advantage using the (non-blocking) NIO API for UDP? Or should I just use the easier "traditional" io API?

推荐答案

冒着被指责回来的风险,该帖子解释说UDP不会阻塞TCP ACK,但你仍然可以阻止内核缓冲区溢出。只有当你有一个非常大的UDP突发时才会发生这种情况。

At the risk of just pointing you back, the comments to that post explain that UDP doesn't block on the TCP ACK, but you could still block on a kernel buffer overflow. This would happen only if you have a very big UDP burst.

这篇关于我应该使用(非阻塞)NIO用于UDP吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆