@Override
    public void run() {

        try {


            //welcome message print
            writeMessage("Welcome to chat server 0.1 beta \n");

            //check if there is a offline message for the logged in user
            CheckChatHistory(recievedUsername);
            
            System.out.println("User: " + recievedUsername + " logged in with password: " + recievedPassword);

            while (true) {
                //prepare incoming message for sending to corresponding client
                String fullMessage = in.readUTF().toString();
                System.out.println("INCOMING: " + fullMessage);
                             
                dataProcessing(fullMessage);           
                
            }
        } catch (IOException e) {
            System.out.println("in or out failed");
            //System.exit(-1);
        }
        
    }