mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08: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,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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue