本文整理匯總了C#中NetMQ.Msg.Copy方法的典型用法代碼示例。如果您正苦於以下問題:C# Msg.Copy方法的具體用法?C# Msg.Copy怎麽用?C# Msg.Copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NetMQ.Msg
的用法示例。
在下文中一共展示了Msg.Copy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ProxyBetween
private static void ProxyBetween(IReceivingSocket from, IOutgoingSocket to, [CanBeNull] IOutgoingSocket control)
{
var msg = new Msg();
msg.InitEmpty();
var copy = new Msg();
copy.InitEmpty();
while (true)
{
from.Receive(ref msg);
var more = msg.HasMore;
if (control != null)
{
copy.Copy(ref msg);
control.Send(ref copy, more);
}
to.Send(ref msg, more);
if (!more)
break;
}
copy.Close();
msg.Close();
}
示例2: ProxyBetween
private static void ProxyBetween(NetMQSocket from, NetMQSocket to, [CanBeNull] NetMQSocket control)
{
var msg = new Msg();
msg.InitEmpty();
var copy = new Msg();
copy.InitEmpty();
while (true)
{
from.Receive(ref msg, SendReceiveOptions.None);
bool more = from.Options.ReceiveMore;
if (control != null)
{
copy.Copy(ref msg);
control.Send(ref copy, more ? SendReceiveOptions.SendMore : SendReceiveOptions.None);
}
to.Send(ref msg, more ? SendReceiveOptions.SendMore : SendReceiveOptions.None);
if (!more)
{
break;
}
}
copy.Close();
msg.Close();
}