本文整理汇总了C#中ZyGames.Framework.RPC.IO.MessageStructure.ReadHeadGzip方法的典型用法代码示例。如果您正苦于以下问题:C# MessageStructure.ReadHeadGzip方法的具体用法?C# MessageStructure.ReadHeadGzip怎么用?C# MessageStructure.ReadHeadGzip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZyGames.Framework.RPC.IO.MessageStructure
的用法示例。
在下文中一共展示了MessageStructure.ReadHeadGzip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNetTcpCallback
private static void OnNetTcpCallback(object sender, RemoteEventArgs e)
{
try
{
RemoteService proxy = sender as RemoteService;
if (proxy == null)
{
return;
}
try
{
using (var ms = new MessageStructure(e.Data))
{
var head = ms.ReadHeadGzip();
if (head != null)
{
var package = proxy.Find(head.MsgId);
if (package != null)
{
package.Message = ms.ReadBuffer();
proxy.Remove(head.MsgId);
package.OnCallback();
return;
}
}
}
}
catch (Exception)
{ }
proxy.OnPushedHandle(e);
}
catch (Exception ex)
{
TraceLog.WriteError("OnNetTcpCallback error:{0}", ex);
}
}
示例2: OnReceive
private static void OnReceive(object sender, SocketEventArgs e)
{
var myConnect = ((ClientSocket)sender).UserData as MyConnect;
if (myConnect != null)
{
var stream = new MessageStructure(e.Data);
var head = stream.ReadHeadGzip();
var pack = new MyPack() { Head = head, Data = e.Data };
myConnect.actionPools.Enqueue(pack);
}
}
示例3: DoReceive
private void DoReceive(byte[] data)
{
try
{
MessageStructure writer = new MessageStructure(data);
var head = writer.ReadHeadGzip();
if (head.Success)
{
SuccessCallback(writer, head);
}
else
{
FailCallback(head);
}
}
catch (Exception ex)
{
new BaseLog().SaveLog(ex);
}
}
示例4: DoRunProcess
private void DoRunProcess(byte[] sendData)
{
bool success = false;
try
{
MessageStructure reader = null;
MessageHead head = null;
_stepTimer.StartTime();
_session.Proxy.SendAsync(sendData, data =>
{
try
{
if (data.Length == 0) return true;
reader = new MessageStructure(data);
head = reader.ReadHeadGzip();
return head.Action.ToString() == Action;
}
catch (Exception ex)
{
TraceLog.WriteError("Step {0} error:{1}", Action, ex);
return false;
}
});
if (CheckCompleted(head) && DecodePacket(reader, head))
{
success = true;
_stepTimer.Completed();
}
}
catch (Exception ex)
{
_stepTimer.PushError(ex.Message);
}
finally
{
_stepTimer.StopTime();
}
if (success && ChildStep != null)
{
ChildStep.StartRun();
}
}