GameBase.Network.PacketOut.Flush C# (CSharp) Méthode

Flush() public méthode

public Flush ( ) : byte[]
Résultat byte[]
        public byte[] Flush()
        {
            write.Flush();
            byte[] ret = stream.GetBuffer();
            byte[] v1 = new byte[2];
            v1[0] = ret[0]; v1[1] = ret[1];
            ushort nLen = BitConverter.ToUInt16(v1, 0);
            if (m_key != null)
            {

                m_key.EncodePacket(ref ret, nLen);
            }
            byte[] retdata = new byte[nLen];
            Buffer.BlockCopy(ret, 0, retdata, 0, nLen);
            return retdata;
        }

Usage Example

Exemple #1
0
        public static void SendConnectMapServer(GameSession session, int key, int key2)
        {
            byte[] defdata = { 232, 16, 67, 3 };
            byte[] defdata2 = { 121, 39, 0, 0, 49, 50, 48, 46, 49, 51, 50, 46, 54,
                                          57, 46, 49, 52, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            byte[] ipdata = Coding.GetDefauleCoding().GetBytes(m_GameServerIP);

            PacketOut packout = new PacketOut(session.GetGamePackKeyEx());
            packout.WriteUInt16(84);
            packout.WriteUInt16(PacketProtoco.S_GAMESERVERINFO);
            packout.WriteInt32(key);
            packout.WriteInt32(key2);
            packout.WriteInt32(m_GameServerPort);
            packout.WriteBuff(defdata);
            packout.WriteBuff(ipdata);
            for (int i = 0; i < 28 - ipdata.Length; i++)
            {
                packout.WriteByte(0);
            }
            packout.WriteBuff(defdata2);

            defdata = packout.Flush();
            server.SendData(session.m_Socket, defdata);
        }
All Usage Examples Of GameBase.Network.PacketOut::Flush