Prevent server from running if required ports are busy

This commit is contained in:
Yury committed 2021-11-06 21:22:24 +03:00
1 parent 957a040996
commit 55e11ffb5c
1 file changed
+10
+10
View File
@@ -34,6 +34,16 @@ public class Main {
return;
}
try {
new ServerSocket(6969).close();
new ServerSocket(35903).close();
new ServerSocket(21110).close();
} catch (IOException e) {
LogManager.log.severe("SlimeVR start-up error! Required ports are busy. Make sure there is no other instance of SlimeVR Server running.");
JOptionPane.showMessageDialog(null, "SlimeVR start-up error! Required ports are busy. Make sure there is no other instance of SlimeVR Server running.", "SlimeVR: Ports are busy", JOptionPane.ERROR_MESSAGE);
return;
}
try {
vrServer = new VRServer();
vrServer.start();