///////////////////////////////////////////////////////////////////////////////// // Client connecting ///////////////////////////////////////////////////////////////////////////////// #region Client Connect public void Connect() { //Wrap our function inside a catcher try { //Open our packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); byte type = Reader.Byte(); Reader.Skip(3); string ID = Reader.Text(); string PW = Reader.Text(); Reader.Close(); //Set login result information int LoginResult = LoginUser(ID, ref PW, ref Player, true); //If the login is succesfull if (LoginResult == 0) { //Send succes packet client.Send(Packet.ConnectSuccess()); } //If the login is wrong else { //Disconnect the user client.Disconnect(PacketInformation.Client); } } catch (Exception ex) { Console.WriteLine("Client connect error {0}", ex); Systems.Debugger.Write(ex); } }