如何使用 python 检查来自特定 ip 地址的连接是否仍然存在。
最佳答案
ping IP地址
import os
#192.168.1.10 is the ip address
ret = os.system("ping -o -c 3 -W 3000 192.168.1.10")
if ret != 0:
print "pc still alive"
好吧,在任何情况下,您确实想检查您尝试连接的 PC 上传入连接的可用性,您需要制作一个程序来接收已经不可能的连接。
关于python - 使用 Python 检查来自 IP 地址的网络连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16808721/