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


Python Host.start方法代码示例

本文整理汇总了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)
开发者ID:michelesr,项目名称:network-monitor-server,代码行数:50,代码来源:netmapping.py

示例2: start

# 需要导入模块: from host import Host [as 别名]
# 或者: from host.Host import start [as 别名]
 def start(self, model_checker):
     Host.start(self, model_checker)
开发者ID:mcanini,项目名称:nice,代码行数:4,代码来源:tcp_server.py

示例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"
开发者ID:BADSA,项目名称:TEC_land,代码行数:32,代码来源:main.py

示例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)
开发者ID:mcanini,项目名称:nice,代码行数:7,代码来源:tcp_client.py


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