Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-blocking DatagramSocket?

I'm currently developing a client application for Android that is supposed to do non-blocking reception of packets through UDP. Is there any way to setup a DatagramSocket so that it is non-blocking on its receive()?

Basically what I'm asking is how to set the MSG_DONTWAIT flag for a DatagramSocket.

like image 858
Sergio Morales Avatar asked Oct 25 '25 02:10

Sergio Morales


1 Answers

What you are looking for is java.nio.channels.DatagramChannel and friends.

like image 153
user207421 Avatar answered Oct 26 '25 17:10

user207421