当前位置: 首页>>代码示例>>C#>>正文


C# Address.ToString方法代码示例

本文整理汇总了C#中Brunet.Address.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Address.ToString方法的具体用法?C# Address.ToString怎么用?C# Address.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Brunet.Address的用法示例。


在下文中一共展示了Address.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddressInSubjectAltName

    ///<summary>Verify the edge by comparing the address in the certificate to
    ///the one provided in the overlay.</summary>
    public static bool AddressInSubjectAltName(Node node, Edge e, Address addr) {
      SecureEdge se = e as SecureEdge;
      if(se == null) {
        throw new Exception("Invalid edge type!");
      }

      return se.SA.VerifyCertificateBySubjectAltName(addr.ToString());
    }
开发者ID:kyungyonglee,项目名称:BrunetTutorial,代码行数:10,代码来源:EdgeVerification.cs

示例2: GetString

 private static string GetString(Address target, IEnumerable forwarders) {
   var sb = new System.Text.StringBuilder();
   sb.Append("brunet.tunnel://");
   sb.Append(target.ToString().Substring(12));
   sb.Append("/");
   foreach(object forwarder in forwarders) {
     Address addr = forwarder as Address;
     if(addr == null) {
       addr = (forwarder as Brunet.Connections.Connection).Address;
     }
     sb.Append(addr.ToString().Substring(12,8));
     sb.Append("+");
   }
   if(sb[sb.Length - 1] == '+') {
     sb.Remove(sb.Length - 1, 1);
   }
   return sb.ToString();
 }
开发者ID:hseom,项目名称:hseom_brunet,代码行数:18,代码来源:TunnelTransportAddress.cs

示例3: SendRpcMessage

    protected void SendRpcMessage(Address addr, string method, 
      string query, bool secure) {

      System.DateTime sent = System.DateTime.Now;

#if !SVPN_NUNIT
      string meth_call = RPCID + "." + method;
      Channel q = new Channel();
      q.CloseAfterEnqueue();
      q.CloseEvent += delegate(object obj, EventArgs eargs) {
        try {
          RpcResult res = (RpcResult) q.Dequeue();
          string result = (string) res.Result;

          if(method == "Ping") {
              System.DateTime recv = System.DateTime.Now;
            _times = _times.InsertIntoNew(result, recv);
            TimeSpan rtt = recv - sent;
            _ssm.UpdateLatency(result, rtt.TotalMilliseconds);
          }

          ProtocolLog.WriteIf(SocialLog.SVPNLog,
            String.Format("RPC {0} {1} {2}", addr.ToString(), method, 
            query));

        } catch(Exception e) {
          ProtocolLog.WriteIf(SocialLog.SVPNLog, e.ToString());
        }
      };

      ISender sender;
      if(!secure) {
        sender = new AHExactSender(_node.Node, addr);
      }
      else {
        sender = _node.Bso.GetSecureSender(addr);
      }
      _rpc.Invoke(sender, q, meth_call, _node.Address, query);
#endif
    }
开发者ID:ikaragkiozoglou,项目名称:brunet,代码行数:40,代码来源:SocialConnectionManager.cs

示例4: CreateShortcutCallback

 /**
  * Callback function that is invoked when TargetSelector fetches candidate scores in a range.
  * Initiates connection setup. 
  * Node: All connection messages can be tagged with a token string. This token string is currenly being
  * used to keep the following information about a shortcut:
  * 1. The node who initiated the shortcut setup.
  * 2. The random target near which shortcut was chosen.
  * @param start address pointing to the start of range to query.
  * @param score_table list of candidate addresses sorted by score.
  * @param current currently selected optimal (nullable) 
  */
 protected void CreateShortcutCallback(Address start, SortedList score_table, Address current) {
   if (score_table.Count > 0) {
     /**
      * we remember our address and the start of range inside the token.
      * token is the concatenation of 
      * (a) local node address
      * (b) random target for the range queried by target selector
      */
     string token = _node.Address + start.ToString();
     //connect to the min_target
     Address min_target = (Address) score_table.GetByIndex(0);
     ISender send = null;
     if (start.Equals(min_target)) {
       //looks like the target selector simply returned our random address
       if (LogEnabled) {
         ProtocolLog.Write(ProtocolLog.SCO, 
                           String.Format("SCO local: {0}, Connecting (shortcut) to min_target: {1} (greedy), random_target: {2}.", 
                                         _node.Address, min_target, start));
       }
       //use a greedy sender
       send = new AHGreedySender(_node, min_target);
     } else {
       if (LogEnabled) {
         ProtocolLog.Write(ProtocolLog.SCO, 
                           String.Format("SCO local: {0}, Connecting (shortcut) to min_target: {1} (exact), random_target: {2}.", 
                               _node.Address, min_target, start));
       }
       //use exact sender
       send = new AHExactSender(_node, min_target);
     }
     ConnectTo(send, min_target, STRUC_SHORT, token);
   }
 }
开发者ID:twchoi,项目名称:tmp-brunet-deetoo,代码行数:44,代码来源:StructuredShortcutConnectionOverlord.cs

示例5: ContainsForwarder

 public bool ContainsForwarder(Address addr) {
   var test_mem = MemBlock.Reference(Base32.Decode(addr.ToString().Substring(12, 8)));
   return _forwarders.BinarySearch(test_mem) >= 0;
 }
开发者ID:hseom,项目名称:hseom_brunet,代码行数:4,代码来源:TunnelTransportAddress.cs

示例6: ContainsForwarder

    public bool ContainsForwarder(Address addr) {
      MemBlock test_mem = MemBlock.Reference(Base32.Decode(addr.ToString().Substring(12, 8)));
      if (_forwarders.Contains(test_mem)) {
	return true;
      } 

      return false;
    }
开发者ID:xujyan,项目名称:brunet,代码行数:8,代码来源:TransportAddress.cs

示例7: GetString

    private static string GetString(Address target, ArrayList forwarders) {
      string s = "brunet.tunnel://" +  
	target.ToString().Substring(12) + "/";
      for (int idx = 0; idx < forwarders.Count; idx++) {
	Address a = (Address) forwarders[idx];
	s +=  a.ToString().Substring(12,8);
	if (idx < forwarders.Count - 1) {
	  //not the last element
	  s = s + "+";
	}      
      }
      return s;
    }
开发者ID:xujyan,项目名称:brunet,代码行数:13,代码来源:TransportAddress.cs


注:本文中的Brunet.Address.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。