本文整理汇总了C#中MemBlock.ToBase16String方法的典型用法代码示例。如果您正苦于以下问题:C# MemBlock.ToBase16String方法的具体用法?C# MemBlock.ToBase16String怎么用?C# MemBlock.ToBase16String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemBlock
的用法示例。
在下文中一共展示了MemBlock.ToBase16String方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Announce
/**
* When a packet is to be delivered to this node,
* this method is called. This method is public so that
* we can chain protocols through the node. For instance,
* after a packet is handled, it may be a wrapped packet
* which actually contains another packet inside. Thus,
* the unwrapped packet could be "Announced" by the handler
*
* One needs to be careful to prevent an infinite loop of
* a Handler announcing the packet it is supposed to handle.
*/
protected virtual void Announce(MemBlock b, ISender from)
{
//When Subscribe or unsubscribe are called,
//they make copies of the ArrayList, thus we
//only need to hold the sync while we are
//getting the list of handlers.
/*
* Note that getting from Hashtable is threadsafe, multiple
* threads writing is a problem
*/
MemBlock payload = null;
int handlers = 0;
MultiSource ns = null;
PType t = null;
try {
t = PType.Parse(b, out payload);
ns = (MultiSource)DemuxHandler.GetTypeSource(t);
handlers = ns.Announce(payload, from);
/**
* @todo if no one handled the packet, we might want to send some
* ICMP-like message.
*/
if( handlers == 0 ) {
string p_s = payload.GetString(System.Text.Encoding.ASCII);
ProtocolLog.WriteIf(ProtocolLog.Exceptions, String.Format(
"No Handler for packet type: {0} from: {2}\n{1} :: {3}", t, p_s, from, b.ToBase16String()));
}
}
catch(Exception x) {
ProtocolLog.WriteIf(ProtocolLog.Exceptions, String.Format(
"Packet Handling Exception"));
string nodeSource = "null";
if (ns != null) {
nodeSource = ns.ToString();
}
ProtocolLog.WriteIf(ProtocolLog.Exceptions, String.Format(
"Handler: {0}\tEdge: {1}", nodeSource, from));
ProtocolLog.WriteIf(ProtocolLog.Exceptions, String.Format(
"Exception: {0}", x));
}
}