当前位置: 首页>>代码示例>>C#>>正文


C# PacketWriter.Flush方法代码示例

本文整理汇总了C#中Framework.Network.Packets.PacketWriter.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.Flush方法的具体用法?C# PacketWriter.Flush怎么用?C# PacketWriter.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Framework.Network.Packets.PacketWriter的用法示例。


在下文中一共展示了PacketWriter.Flush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Send

        public void Send(ref PacketWriter packet)
        {
            if (packet.Opcode == 0)
                return;

            var buffer = packet.ReadDataToSend();

            try
            {
                if (Crypt.IsInitialized)
                {
                    uint totalLength = (uint)packet.Size - 2;
                    totalLength <<= 13;
                    totalLength |= ((uint)packet.Opcode & 0x1FFF);

                    var header = BitConverter.GetBytes(totalLength);

                    Crypt.Encrypt(header);

                    buffer[0] = header[0];
                    buffer[1] = header[1];
                    buffer[2] = header[2];
                    buffer[3] = header[3];
                }

                clientSocket.Send(buffer, 0, buffer.Length, SocketFlags.None);

                string clientInfo = ((IPEndPoint)clientSocket.RemoteEndPoint).Address + ":" + ((IPEndPoint)clientSocket.RemoteEndPoint).Port;
                PacketLog.WritePacket(clientInfo, packet);

                packet.Flush();
            }
            catch (Exception ex)
            {
                Log.Message(LogType.Error, "{0}", ex.Message);
                Log.Message();

                clientSocket.Close();
            }
        }
开发者ID:Khiy,项目名称:Arctium-WoW,代码行数:40,代码来源:WorldClass.cs

示例2: Send

        public async void Send(PacketWriter packet)
        {
            DataBuffer = packet.ReadDataToSend(true);

            try
            {
                DataWriter writer = new DataWriter(clientSocket.OutputStream);
                writer.WriteBytes(DataBuffer);

                await writer.StoreAsync();
                packet.Flush();
            }
            catch (Exception ex)
            {
                Log.Message(LogType.ERROR, "{0}", ex.Message);
                Log.Message();

                clientSocket.Dispose();
            }
        }
开发者ID:concept45,项目名称:Arctium-RT,代码行数:20,代码来源:RealmClass.cs

示例3: Send

        public void Send(PacketWriter packet)
        {
            if (packet == null)
                return;

            DataBuffer = packet.ReadDataToSend(true);

            try
            {
                clientSocket.Send(DataBuffer, DataBuffer.Length, SocketFlags.None);
                packet.Flush();
            }
            catch (SocketException ex)
            {
                Log.Message(LogType.ERROR, "{0}", ex.Message);
                Log.Message();

                clientSocket.Close();
            }
        }
开发者ID:ArkantosWoW,项目名称:ArkantosEmu,代码行数:20,代码来源:RealmClass.cs

示例4: Send

        public void Send(PacketWriter packet)
        {
            DataBuffer = packet.ReadDataToSend(true);

            try
            {
                clientSocket.BeginSend(DataBuffer, 0, DataBuffer.Length, SocketFlags.None, new AsyncCallback(FinishSend), clientSocket);
                packet.Flush();
            }
            catch (Exception ex)
            {
                Log.Message(LogType.ERROR, "{0}", ex.Message);
                Log.Message();
                clientSocket.Close();
            }
        }
开发者ID:boredtodeath,项目名称:Arctium,代码行数:16,代码来源:RealmClass.cs


注:本文中的Framework.Network.Packets.PacketWriter.Flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。