mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
ensure closing of datagram socket in arcane Util
This commit is contained in:
parent
63dbfb8a9b
commit
338e9833cc
1 changed files with 7 additions and 3 deletions
|
@ -37,9 +37,13 @@ public final class Util {
|
|||
}
|
||||
|
||||
public static void broadcast(byte[] data, int port) throws IOException {
|
||||
DatagramSocket socket = new DatagramSocket();
|
||||
broadcast(socket, data, port, NetworkInterface.getNetworkInterfaces());
|
||||
socket.close();
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue