本文整理汇总了C#中Brunet.MemBlock.ToMemoryStream方法的典型用法代码示例。如果您正苦于以下问题:C# MemBlock.ToMemoryStream方法的具体用法?C# MemBlock.ToMemoryStream怎么用?C# MemBlock.ToMemoryStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Brunet.MemBlock
的用法示例。
在下文中一共展示了MemBlock.ToMemoryStream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleData
public void HandleData(MemBlock data, ISender return_path, object state)
{
/*
* Write the messages:
*/
Console.WriteLine("Msg from: {0}", return_path);
data.ToMemoryStream().WriteTo( System.Console.OpenStandardOutput() );
Console.WriteLine();
return_path.Send( new CopyList(PType.Protocol.Chat, MemBlock.Null) );
}
示例2: HandleEdgeSync
/**
* Handle periodic synchronization messages for edge maintenance.
* @param remoteid remote id for the edge.
* @param localid local id for the edge.
* @param rest_of_payload control message.
*/
protected void HandleEdgeSync(int remoteid, int localid, MemBlock rest_of_payload) {
#if TUNNEL_DEBUG
Console.Error.WriteLine("Receiving edge control");
#endif
TunnelEdge tun_edge = null;
lock( _sync ) {
tun_edge = GetTunnelEdge(localid, remoteid);
}
if (tun_edge != null) {
ArrayList arg;
ArrayList forwarders = new ArrayList();
using(MemoryStream payload_ms = rest_of_payload.ToMemoryStream()) {
arg = (ArrayList) AdrConverter.Deserialize(payload_ms);
//list of forwarders
for (int i = 0; i < arg.Count; i++) {
forwarders.Add(AddressParser.Parse(MemBlock.Reference((byte[]) arg[i])));
}
}
tun_edge.HandleSyncPacket(forwarders);
}
}