本文整理汇总了C#中FrameWork.PacketIn.DecodeMythicSize方法的典型用法代码示例。如果您正苦于以下问题:C# PacketIn.DecodeMythicSize方法的具体用法?C# PacketIn.DecodeMythicSize怎么用?C# PacketIn.DecodeMythicSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameWork.PacketIn
的用法示例。
在下文中一共展示了PacketIn.DecodeMythicSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnReceive
protected override void OnReceive(byte[] Packet)
{
lock (this)
{
PacketIn packet = new PacketIn(Packet, 0, Packet.Length);
long byteLeft = packet.Length;
while (byteLeft > 0)
{
if (!m_expectData)
{
long StartPos = packet.Position;
m_expectSize = packet.DecodeMythicSize();
long EndPos = packet.Position;
long Diff = EndPos - StartPos;
byteLeft -= Diff;
if (m_expectSize <= 0)
{
packet.Opcode = packet.GetUint8();
packet.Size = (ulong)m_expectSize;
_srvr.HandlePacket(this, packet);
return;
}
if (byteLeft <= 0)
return;
Opcode = packet.GetUint8();
byteLeft -= 1;
m_expectData = true;
}
else
{
m_expectData = false;
if (byteLeft >= m_expectSize)
{
long Pos = packet.Position;
packet.Opcode = Opcode;
packet.Size = (ulong)m_expectSize;
_srvr.HandlePacket(this, packet);
byteLeft -= m_expectSize;
packet.Position = Pos;
packet.Skip(m_expectSize);
}
else
{
Log.Error("OnReceive", "Data count incorrect :" + byteLeft + " != " + m_expectSize);
}
}
}
packet.Dispose();
}
}