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


C# GSPacketIn.WriteHeader方法代码示例

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


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

示例1: WritePacket_

 public void WritePacket_(GSPacketIn pkg)
 {
     pkg.WriteHeader();
     Write(pkg.Buffer, 0, pkg.Length);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:5,代码来源:GSPacketIn.cs

示例2: OnRecvPacket

 /// <summary>
 /// 收到协议包
 /// </summary>
 /// <param name="pkg"></param>
 public override void OnRecvPacket(GSPacketIn pkg)
 {
     if (m_packetProcessor == null)
     {
         m_packetLib = AbstractPacketLib.CreatePacketLibForVersion(1, this);
         m_packetProcessor = new PacketProcessor(this);
     }
     if (m_player != null)
     {
         pkg.ClientID = m_player.PlayerId;
         pkg.WriteHeader();
     }
     //LogMsg(Marshal.ToHexDump("recevie:", pkg.Buffer, 0, pkg.Length));
     m_packetProcessor.HandlePacket(pkg);
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:19,代码来源:GameClient.cs

示例3: WritePacket

 public void WritePacket(GSPacketIn content)
 {
     content.WriteHeader();
     WriteShort((short)content.Length);
     WriteShort(0);
     Write(content.Buffer, 2, content.Length - 2);
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:7,代码来源:GSPacketIn.cs

示例4: SendTCP

        public void SendTCP(GSPacketIn packet)
        {
            //Fix the packet size
            packet.WriteHeader();

            //reset the offset for read
            packet.Offset = 0;

            //Check if client is connected
            if (m_client.Socket.Connected)
            {
                try
                {
                    Statistics.BytesOut += packet.Length;
                    Statistics.PacketsOut++;

                    if (log.IsDebugEnabled)
                    {
                        log.Debug(Marshal.ToHexDump(string.Format("Send Pkg to {0} :", m_client.TcpEndpoint), packet.Buffer, 0, packet.Length));
                    }

                    lock (m_tcpQueue.SyncRoot)
                    {
                        m_tcpQueue.Enqueue(packet);
                        if (m_sendingTcp)
                        {
                            return;
                        }
                        else
                        {
                            m_sendingTcp = true;
                        }
                    }

                    if (m_client.AsyncPostSend)
                    {
                        ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncSendTcpImp), this);
                    }
                    else
                    {
                        AsyncTcpSendCallback(this, send_event);
                    }
                }
                catch (Exception e)
                {
                    log.Error("SendTCP", e);
                    log.WarnFormat("It seems <{0}> went linkdead. Closing connection. (SendTCP, {1}: {2})", m_client, e.GetType(), e.Message);
                    m_client.Disconnect();
                }
            }
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:51,代码来源:StreamProcessor.cs


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