本文整理汇总了Python中monitor.Monitor.startUDPConnection方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.startUDPConnection方法的具体用法?Python Monitor.startUDPConnection怎么用?Python Monitor.startUDPConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitor.Monitor
的用法示例。
在下文中一共展示了Monitor.startUDPConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OptionParser
# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import startUDPConnection [as 别名]
#!/usr/bin/env python
from monitor import Monitor
from optparse import OptionParser
import subprocess
if(__name__ == '__main__'):
process = subprocess.Popen(['uname', '-I'], stdout=subprocess.PIPE)
localhost_ip = process.stdout.read().strip()
parser = OptionParser()
parser.add_option("-a", "--address", dest="address", default=localhost_ip,
help="ADDRESS of localhost", metavar="ADDRESS")
parser.add_option("-p", "--port", dest="port", type="int", default=2712,
help="PORT of localhost to listen to", metavar="PORT")
parser.add_option("-d", "--duration", dest="duration", type="int", default=10,
help="DURATION of experiment", metavar="DURATION")
parser.add_option("-P", "--protocol", dest="protocol", default="UDP",
help="Communication PROTOCOL", metavar="PROTOCOL")
(options, args) = parser.parse_args()
monitor = Monitor(ip=options.address, port=options.port,
duration=options.duration, connectionType=options.protocol)
monitor.startUDPConnection()