import os
import subprocess
import threading
import time
def rr():
s=subprocess.Popen(["iperf3.exe","-s -p 5005"], stdout=subprocess.PIPE, universal_newlines=True)
time.sleep(0.5)
print(s.stdout.readline())
def rr1():
print(os.system('iperf3.exe -s -p 5005'))
threading.Thread(target=rr,).start()
time.sleep(10)
threading.Thread(target=rr1,).start() #-1073741515
time.sleep(10)
运行rr后, cmd中输入netstat -aon | findstr "[^0-9]5005[^0-9]" 查看iperf服务是否开启,发现未开启。python中也没有回显。
运行rr1,返回错误代码-1073741515,百度是缺失组件。
发现是缺少了cygwin1.dll组件,把该组件放到iperf3.exe同目录下即可