本文整理汇总了Python中pyndn.Face.isLocal方法的典型用法代码示例。如果您正苦于以下问题:Python Face.isLocal方法的具体用法?Python Face.isLocal怎么用?Python Face.isLocal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyndn.Face
的用法示例。
在下文中一共展示了Face.isLocal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onRegisterSuccess
# 需要导入模块: from pyndn import Face [as 别名]
# 或者: from pyndn.Face import isLocal [as 别名]
import time
from pyndn import Face, Name, Data, KeyLocator, Interest
from pyndn.security import KeyChain
#from pyndn.node import Node
def onRegisterSuccess(prefix, registeredPrefixId):
print "Registered: " + prefix.toUri()
def onRegisterFailed(prefix):
print "Prefix registration failed: " + prefix.toUri()
def onInterest(prefix, interest, face, interestFilterId, filter):
print "Got interest " + interest.getName().toUri()
face = Face("128.97.98.7", 6363)
print "Local face is: " + str(face.isLocal())
keyChain = KeyChain()
face.setCommandSigningInfo(keyChain, keyChain._identityManager.getDefaultCertificateNameForIdentity(Name("/ndn/edu/ucla/remap/%40GUEST/wangzhehao410305%40gmail.com")))
face.registerPrefix("/ndn/edu/ucla/remap/zhehao", onInterest, onRegisterFailed, onRegisterSuccess)
while True:
face.processEvents()
# We need to sleep for a few milliseconds so we don't use 100% of the CPU.
time.sleep(0.01)