Occasional java.io.IOException: operation is not allowed only on Android 7.0 by DatagramSocket.send ()

The following code works almost 100% on all Android 7.0 Android devices:

DatagramSocket clientSocket = new DatagramSocket();
clientSocket.setSoTimeout(4000);
clientSocket.setReuseAddress(true);        
clientSocket.setBroadcast(true);
...
DatagramPacket dpSend = new DatagramPacket(baSendData, baSendData.length, InetAddress.getByName("239.255.255.250"), 3702);
clientSocket.send(dpSend);

On Android 7.0, only on Android 7.0, clientSocket.send (dpSend) sometimes causes the following error. I want to emphasize " sometimes ." It works great in most cases.

I am wondering if anyone can give an idea of ​​Android 7.0 in order to shed light on why the exception only happens on Android 7.0.

+4
source share

Source: https://habr.com/ru/post/1673724/


All Articles