public void run() {
        try {
            while(running) {
                Thread.sleep(10);
                if(playing == true) {
                    if (isClient == true){
                            writeObject = new ReadObject(clientSocket, game);
                            isClient = false;
                            System.out.println("is Client");   
                            running = false;
                    }
                    
                    if(ishost == true) {
                        if(waitforclient == true) {
                 
                            connectionSocket = serverSocket.accept();
                            
                            //Startgame
                            lobby.StartGame(this);

                            writeObject = new ReadObject(connectionSocket, game);
                                                                         
                            System.out.println("Client connection accepted from: "+connectionSocket.getInetAddress());
                            waitforclient = false;
                            running = false;
                        }
                    }
                }
            }
        } catch(InterruptedException | IOException ex) {
            System.out.println("TCPNetwork Exception: "+ex.getMessage());
        }
    }