protected void doLogin() {

        try {
            CheckUser(user, pass);
            switch (this.LOGIN_RESULT) {
                
                case 0:
                    updateaccount(user);
                    this.socketOut.write(new String(LoginServer.LOGINHEADER, "ISO8859-1"));
                    this.socketOut.flush();
                    this.socketOut.write(new String(LoginServer.LOGIN_SUCCESSBYTE,"ISO8859-1"));
                    this.socketOut.flush();
                    this.LOGIN_RESULTSTR = "Success";
                    this.socket.close();
                    break;
                case 1:
                default:
                    this.socketOut.write(new String(LoginServer.LOGINHEADER, "ISO8859-1"));
                    this.socketOut.flush();
                    this.socketOut.write(new String(LoginServer.LOGIN_INCUSERBYTE,"ISO8859-1"));
                    this.socketOut.flush();
                    this.LOGIN_RESULTSTR = "Incorrect Username";
                    break;
                case 2:
                    this.socketOut.write(new String(LoginServer.LOGINHEADER, "ISO8859-1"));
                    this.socketOut.flush();
                    this.socketOut.write(new String(LoginServer.LOGIN_INCPASSBYTE,"ISO8859-1"));
                    this.socketOut.flush();
                    this.LOGIN_RESULTSTR = "Incorrect Password";
                    break;
                case 3:
                    this.socketOut.write(new String(LoginServer.LOGINHEADER, "ISO8859-1"));
                    this.socketOut.flush();
                    this.socketOut.write(new String(LoginServer.LOGIN_BANUSERBYTE,"ISO8859-1"));
                    this.socketOut.flush();
                    this.LOGIN_RESULTSTR = "Banned Username";
                    break;
                case 4:
                    this.socketOut.write(new String(LoginServer.LOGINHEADER, "ISO8859-1"));
                    this.socketOut.flush();
                    this.socketOut.write(new String(LoginServer.LOGIN_ALREADYLOGGEDIN,"ISO8859-1"));
                    this.socketOut.flush();
                    this.LOGIN_RESULTSTR = "User is already Logged in";
                    break;
            }
            debug("[SERVER] Login Sent (" + this.LOGIN_RESULTSTR + ")");
        }
        catch (Exception e) {
            debug("Error (write): " + e.getMessage());
        }
    }