Net*_*han 5 python network-programming ip-address python-sockets
如何使用 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"
Run Code Online (Sandbox Code Playgroud)
无论如何,您确实想检查您尝试连接的 PC 上传入连接的可用性,您需要制作一个程序来接收已经不可能的连接。
| 归档时间: |
|
| 查看次数: |
38030 次 |
| 最近记录: |