本文整理汇总了Python中host.Host.start方法的典型用法代码示例。如果您正苦于以下问题:Python Host.start方法的具体用法?Python Host.start怎么用?Python Host.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类host.Host
的用法示例。
在下文中一共展示了Host.start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from host import Host [as 别名]
# 或者: from host.Host import start [as 别名]
def run(self):
"""
Metodo run del thread, viene richiamato tramite start().
Viene eseguito un loop che cerca a intervalli di 30 secondi
nuovi hosts sulla rete e per ogni host che trova inizializza
un thread che ne raccoglie le informazioni.
I vari thread vengono raccolti all'interno di una lista.
L'indirizzo della rete viene preso dalla linea di comando o se
non fornito si cerca di indovinarlo a partire dall'ip della
macchina (assumendo che la netmask sia 255.255.255.0
come spesso si verifica).
"""
self.known_hosts = []
if '-n' in argv:
network_address = argv[argv.index('-n') + 1]
elif '--network' in argv:
network_address = argv[argv.index('--network') + 1]
else:
network_address = get_network_address()
if not network_address:
print("Cannot find network address... program will continue without network scanning!\n" +
"If this trouble persist, try providing the network address in the launch command!\n" +
"Press CTRL-C to terminate!")
exit()
while(True):
hosts = host_discovery(network_address)
for host in hosts:
if not (host in self.known_hosts):
self.known_hosts.append(host)
print("Starting thread for host %s" % host)
thread = Host(host)
self.threads.append(thread)
thread.start()
for thread in self.threads:
if not thread.is_alive:
self.known_hosts.remove(thread.info['ip'])
sleep(30)
示例2: start
# 需要导入模块: from host import Host [as 别名]
# 或者: from host.Host import start [as 别名]
def start(self, model_checker):
Host.start(self, model_checker)
示例3: ConnectionFinder
# 需要导入模块: from host import Host [as 别名]
# 或者: from host.Host import start [as 别名]
# coding=utf-8
"""
Instituto Tecnológico de Costa Rica
Ingeniería en Computación
Redes de Computadoras
Profesor: Kevin Moraga
Estudiantes:
Daniel Solís Méndez
Melvin Elizondo Pérez
I Semestre 2016
"""
from host import Host
from connectionFinder import ConnectionFinder
if __name__ == '__main__':
"""
Point of start for a TEC-Land Host
"""
conFinder = ConnectionFinder()
print "Dynamic Binding"
ip, port = conFinder.look_for_router()
host = Host(ip, port)
if ip is not None:
host.start()
else:
print "No routers available"
示例4: start
# 需要导入模块: from host import Host [as 别名]
# 或者: from host.Host import start [as 别名]
def start(self, model_checker):
Host.start(self, model_checker)
flow_id = self.flows_started
self.flows_started += 1
self.enableAction("start_connection", flow_id)