mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 10:09:42 +00:00
use try-with-resource to mute warning about udpSocket not being closed
This commit is contained in:
1 parent
d168c4df20
commit
55ddef01ce
1 file changed
+2
-1
+2
-1
@@ -30,7 +30,7 @@ public class UDPMirror {
|
||||
}
|
||||
int listeningOnPort = Integer.valueOf(args[c++]);
|
||||
byte[] buf = new byte[65536];
|
||||
DatagramSocket udpSocket = new DatagramSocket(listeningOnPort);
|
||||
try (DatagramSocket udpSocket = new DatagramSocket(listeningOnPort)) {
|
||||
DatagramPacket received = new DatagramPacket(buf, buf.length);
|
||||
DatagramSocket[] sendingSockets = new DatagramSocket[(args.length - 1) / 2];
|
||||
DatagramPacket[] mirroredPackets = new DatagramPacket[(args.length - 1) / 2];
|
||||
@@ -53,6 +53,7 @@ public class UDPMirror {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void usage() {
|
||||
System.out.println("Usage: java "+UDPMirror.class.getName()+" [-v] <listeningport> hostname1 port1 [hostname2 port2]*");
|
||||
|
||||
Reference in new issue
Block a user