Exemple #1
0
        void acceptor_OnClientConnected(Session session)
        {
            Logger.Write(Logger.LogTypes.연결, "클라이언트 {0} 연결됨", session.Socket.RemoteEndPoint.ToString());

            Random rand = new Random();
            int riv = rand.Next();
            int siv = rand.Next();

            session.RIV = new MapleCrypto(BitConverter.GetBytes(riv), Config.MajorVersion);
            session.SIV = new MapleCrypto(BitConverter.GetBytes(siv), Config.MajorVersion);

            PacketWriter packet = new PacketWriter();
            packet.WriteShort(0);
            packet.WriteShort(Config.MajorVersion);
            packet.WriteShort(1);
            packet.WriteByte(0x31);
            packet.WriteInt(riv);
            packet.WriteInt(siv);
            packet.WriteByte(0x08);
            packet.SetShort(0, packet.Length - 2);
            session.SendRawPacket(packet.ToArray());

            Client c = new Client(session);
            mGameServer.Clients.Add(c);
        }
        void _Acceptor_OnClientConnected(Session session)
        {
            Logger.Write(Logger.LogTypes.연결, "opened connection with {0}", session.Socket.RemoteEndPoint.ToString());

            session.RIV = new MapleCrypto(new byte[4], Common.Config.MajorVersion);
            session.SIV = new MapleCrypto(new byte[4], Common.Config.MajorVersion);

            PacketWriter packet = new PacketWriter();
            packet.WriteShort(0);
            packet.WriteShort(Common.Config.MajorVersion);
            packet.WriteShort(1);
            packet.WriteByte(0x31);
            packet.WriteInt(0);
            packet.WriteInt(0);
            packet.WriteByte(0x08);
            packet.SetShort(0, packet.Length - 2);
            session.SendRawPacket(packet.ToArray());

            GameServerConnection con = new GameServerConnection(session);
            _ConnectedClients.Add(con);
        }