Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
根据这篇文章,UDP 不会阻塞。使用(非阻塞)NIO API for UDP 有什么优势吗?还是我应该只使用更简单的“传统”io API?
冒着让你回头的风险,该帖子的评论解释说 UDP 不会阻塞 TCP ACK,但你仍然可以阻塞内核缓冲区溢出。仅当您有一个非常大的 UDP 突发时才会发生这种情况。
如果您正在处理大量流,它可能会帮助您拥有一个专用线程模型来处理这些套接字。NIO 提供了一些有用的工作(选择器)。