Esempio n. 1
0
 private void detectRunningInstance() {
   if (!isPortAvailable(Network.TCP_PORT)) {
     try {
       ChatClient chatClient = new ChatClient("localhost");
       chatClient.connect();
       Client client = chatClient.getClient();
       Diffie.wait(client);
       client.sendTCP(new SecondClientStarted());
     } catch (NullPointerException e) {
       Log.info("Server started, but: " + e.getMessage());
     } finally {
       System.exit(6);
     }
   }
 }
Esempio n. 2
0
 private static String getRandomServer() {
   String host = null;
   try {
     host = ChatClient.discoverRandomServer();
   } catch (NullPointerException e) {
     Log.info("No UDP-Server availible.");
   }
   return host;
 }