private void ConnectSocket(){
        int tries = 0;
        int maxTries = 5;
        while(tries < maxTries) {
            try {
                localServerSocket = new Socket(Ip, Port);
                localServerSocket.setSoTimeout(100);
                in = new DataInputStream(localServerSocket.getInputStream());
                tries = maxTries;
            } catch (IOException e) {
                tries += 1;
                System.out.println("Failed to bind socket, try " + tries + "/" + maxTries);
            }
        }
        try {
            outToServer = new PrintStream(localServerSocket.getOutputStream(), true);
            //  Skicka anslutningsmedelande
            outToServer.write(Message.connectToServerMessage());
        }catch (Exception e){
            System.out.println("Failed to send registration message");
            e.printStackTrace();
        }
    }