You will need to start your server in a separate thread, since .accept is a blocking call. You might want to do something like this:
(new Runnable() { @Override public void run() { try { serverSocket = new ServerSocket(port); }catch(IOException e ){ ui.log(e.toString());//* } while (true){ try{ clienSocket = serverSocket.accept(); ui.log("Incomming Connection.");//* new connectionHandler(clienSocket, ui); }catch(IOException e ){ ui.log(e.toString()); } } } }).start();
NOTE. This code has not been verified, but it should give you an idea of ββwhat you need to do.
source share