ensure closing of datagram socket in arcane Util
@@ -37,10 +37,14 @@ public final class Util {
}
public static void broadcast(byte[] data, int port) throws IOException {
- DatagramSocket socket = new DatagramSocket();
+ DatagramSocket socket = null;
+ try {
+ socket = new DatagramSocket();
broadcast(socket, data, port, NetworkInterface.getNetworkInterfaces());
+ } finally {
socket.close();
}
+ }
private static void broadcast(DatagramSocket socket, byte[] data, int port, Enumeration<NetworkInterface> ifaces)
throws IOException {
