public Server(ServerDataHandler dataHandler){
        this.dataHandler = dataHandler;

        try{
            serverSocket = new ServerSocket(PORT);
        }catch(IOException ioe){
            System.out.println("Could not create server socket on " + HOST + ":" + PORT);
            System.exit(0);
        }

        try {
            HOST = InetAddress.getLocalHost().getHostAddress();
        }catch (Exception e){
            HOST = "localhost";
        }

        System.out.println("Server running on " + HOST + ":" + PORT);

        while(serverOn){
            try{
                Socket clientSocket = serverSocket.accept();
                populateClient(clientSocket);
                clients.add(clientSocket);

                System.out.println(clientSocket + " connected to server");

                ClientServiceThread cliThread = new ClientServiceThread(clientSocket);
                cliThread.start();
            }catch(IOException ioe){
                System.out.println("Exception encountered on connection to socket");
            }
        }

        try{
            serverSocket.close();
            System.out.println("Server stopped");
        }catch(Exception e){
            System.out.println("Problem stopping server socket");
            System.exit(0);
        }
    }