[英]Non-blocking DatagramSocket?
I'm currently developing a client application for Android that is supposed to do non-blocking reception of packets through UDP. 我正在开发一个Android的客户端应用程序,它应该通过UDP进行无阻塞的数据包接收。 Is there any way to setup a DatagramSocket so that it is non-blocking on its receive()?
有没有办法设置DatagramSocket,以便它的receive()上没有阻塞?
Basically what I'm asking is how to set the MSG_DONTWAIT flag for a DatagramSocket. 基本上我要问的是如何为DatagramSocket设置MSG_DONTWAIT标志。
您正在寻找的是java.nio.channels.DatagramChannel
和朋友。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.