private void launchChat() throws RemoteException {
        
        // get the index of the last message sent to the server so that client
        // knows from where they can start printing messages
        this.lastDisplayedMsgIndex = stub.getLastMsgIndex();
        
        String  userInput = "",
                command,
                arg,
                splitInput[];
        
        // while client has not quit, process their commands
        while (!hasQuit) {
            
            command = "";
            arg = "";
            
            // read, format and process user input if it is possible
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            try {
                
                userInput = br.readLine().trim();
                
                if (userInput.length() > 0) {
                    
                    splitInput = userInput.split("\\s+", 2);
                    command = splitInput[0];
                    if (splitInput.length > 1)
                        arg = splitInput[1];
                    
                    processCommand(command, arg);
                }
                
            } catch (IOException e) {
                // ignore exception gracefully
            }
        }
        
    }