@SuppressWarnings("resource")
	@Override
	public void run() {
		// TODO Auto-generated method stub
		int i=0;

		try{
			
			ServerSocket listener = new ServerSocket(port);
			Socket server;
			
			while((i++ < maxConnections) || (maxConnections == 0)){

				gameController.Print("Server: Waiting for Clients");
				server = listener.accept();
				gameController.Print("Server: Client " + NextClientId()  + " Connected.");
				
				clientFramework.add(new ClientHandler(this, server, NextClientId()));
				
			}
			
		} catch (IOException ioe) {
			System.out.println("IOException on socket listen: " + ioe);
			ioe.printStackTrace();
		}
	}