mininet中的ping ping

问题描述 投票:0回答:1

我想同时启动两个或多个主机,以便在mininet中使用python ping通其他两个主机,我这样做并且不起作用

def simpleTest(h1,h2): 

    print (h1.cmd('ping -c5 %s' h2.IP()))

和主要:

if __name__ == '__main__':
    net = Mininet(...)
    threads= 3 # three threads
    #....codes...... 
    for i in range(1, threads):
        hostsrc=net.hosts[i]
        hostdest=net.hosts[i+4]
        thread = threading.Thread(target=simpleTest(hostsrc,hostdest))
        jobs.append(thread)

    for j in jobs:
        j.start()
    for j in jobs:
        j.join()
    """
    codes ...
    """

任何解决方法请...

python multithreading ping sdn mininet
1个回答
0
投票

通过在此行中添加arg起作用...

        thread = threading.Thread(target=simpleTest, args=(hostsrc,hostdest,))
© www.soinside.com 2019 - 2024. All rights reserved.