import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class ConnectionListener { /* * This thread listens for connections from clients. */ public static boolean running = true; private static ServerSocket socketServer; private static GameServer gameServer; /** * @param args */ public static void main(String[] args) { gameServer = new GameServer(); try { socketServer = new ServerSocket(1337); while(running){ Socket clientSocket = null; clientSocket = socketServer.accept(); System.out.println(clientSocket.getInetAddress()+ ":"+clientSocket.getPort()); gameServer.addConnection(clientSocket); } } catch (IOException e) { System.out.println("Accept failed: 1337"); System.exit(-1); } } }