def doPingAvr(target, interface, count):
proc = subprocess.Popen(['ping', ''.join(['-c', str(count)]), '-I', interface, target], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out = proc.communicate()
out = decodeUTF8(out)
syslog(LOG_INFO, out)
try:
out = out.split(' = ')[1]
out = out.split(' ms')[0]
out = out.split('/')[1]
except:
return 0
return out
评论列表
文章目录