tcping
tcping copied to clipboard
今天使用测试了您的模块程序
import subprocess as sp
Print the return code (status=0 mean ping success)
status = sp.call(['tcping', '-c', '1', '-t', '1', 'github.com'], stdout=sp.DEVNULL, stderr=sp.DEVNULL) print(status)
OR print the full message
status = sp.run(['tcping', '-c', '1', '-t', '1', 'github.com'], stdout=sp.DEVNULL, stderr=sp.DEVNULL) print(status)
上面这段代码我在测试的时候发现,不管github.com 这个位置填写的 ip地址还是域名是否能连通,它返回的都会返回0,按您上面描述0等于可以ping通。不知道是为什么。