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


Python Client.setTarget方法代码示例

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


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

示例1: Server

# 需要导入模块: import Client [as 别名]
# 或者: from Client import setTarget [as 别名]
srv3 = Server("vm12c12v01", "192.168.1.4", password)
srv3.setType("tcp")
srv3.listen("5201")
srv3.listen("5202")
srv3.listen("5203")
srv3.start("5")

srv4 = Server("vm12c13v01", "192.168.1.3", password)
srv4.setType("tcp")
srv4.listen("5201")
srv4.listen("5202")
srv4.listen("5203")
srv4.start("5")

cli1 = Client("vm12c10v01", "192.168.1.1", password)
cli1.setTarget("192.168.1.2", "5201")
cli1.setTarget("192.168.1.3", "5201")
cli1.setTarget("192.168.1.4", "5201")

cli2 = Client("vm12c11v01", "192.168.1.2", password)
cli2.setTarget("192.168.1.1", "5201")
cli2.setTarget("192.168.1.3", "5202")
cli2.setTarget("192.168.1.4", "5202")

cli3 = Client("vm12c12v01", "192.168.1.4", password)
cli3.setTarget("192.168.1.1", "5202")
cli3.setTarget("192.168.1.2", "5202")
cli3.setTarget("192.168.1.3", "5203")

cli4 = Client("vm12c13v01", "192.168.1.3", password)
cli4.setTarget("192.168.1.1", "5203")
开发者ID:DoctorSher,项目名称:python-iperf,代码行数:33,代码来源:clique.py

示例2: enumerate

# 需要导入模块: import Client [as 别名]
# 或者: from Client import setTarget [as 别名]
servers = []
threads = []

numPairs = 2
for idx, key in enumerate(srvmap):
	if idx >= numPairs: continue
	srv = Server(key, srvmap[key])
	srv.listen("5201")
	srv.start()
	servers.append(srv)

srvlist = srvmap.items()
for idx, key in enumerate(climap):
	if idx >= numPairs: continue
	cli = Client(key, climap[key])
	cli.setTarget(srvlist[idx][1], "5201")
	cli.setType("udp")
	# cli.setUdpOptions("495m")
	cli.setUdpOptions("495m","1400")
	clients.append(cli)
	print key,climap[key] + " sends to " + srvlist[idx][0],srvlist[idx][1]

for cli in clients:
	thread = threading.Thread(target=partial(cli.run, 10))
	threads.append(thread)

time.sleep(10)

# before = timer()
for thread in threads:
	thread.start()
开发者ID:DoctorSher,项目名称:python-iperf,代码行数:33,代码来源:exp.py


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