Пример #1
0
        public static void SendLoginKickInfo(Account player)
        {
            int serverId = (int)player._status.serverId;

            switch (serverId)
            {
            case 0:
            case (int)byte.MaxValue:
                player.setOnlineStatus(false);
                break;

            default:
                GameServerModel server = ServersXML.getServer(serverId);
                if (server == null)
                {
                    break;
                }
                using (SendGPacket sendGpacket = new SendGPacket())
                {
                    sendGpacket.writeH((short)10);
                    sendGpacket.writeQ(player.player_id);
                    Auth_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection);
                    break;
                }
            }
        }
Пример #2
0
 public static void UpdateGSCount(int serverId)
 {
     try
     {
         if ((DateTime.Now - Auth_SyncNet.LastSyncCount).TotalSeconds < 2.5)
         {
             return;
         }
         Auth_SyncNet.LastSyncCount = DateTime.Now;
         int count = LoginManager._socketList.Count;
         foreach (GameServerModel server in ServersXML._servers)
         {
             if (server._id == serverId)
             {
                 server._LastCount = count;
             }
             else
             {
                 using (SendGPacket sendGpacket = new SendGPacket())
                 {
                     sendGpacket.writeH((short)15);
                     sendGpacket.writeD(serverId);
                     sendGpacket.writeD(count);
                     Auth_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.warning(ex.ToString());
     }
 }
Пример #3
0
        private static void recv(IAsyncResult res)
        {
            if (LoginManager.ServerIsClosed)
            {
                return;
            }
            IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 8000);

            byte[] buffer = Auth_SyncNet.udp.EndReceive(res, ref remoteEP);
            Thread.Sleep(5);
            new Thread(new ThreadStart(Auth_SyncNet.read)).Start();
            if (buffer.Length < 2)
            {
                return;
            }
            Auth_SyncNet.LoadPacket(buffer);
        }