说明:本文实例讲述了python实现ping的方法。分享给大家供大家参考。具体如下:
#!/usr/bin/env python
#coding:utf-8
import os, sys, socket, struct, select, time
# From /usr/include/linux/icmp.h; your milage may vary.
ICMP_ECHO_REQUEST = 8 # Seems to be the same on Solaris.
def checksum(so <weixin_38612527> 上传 | 大小:31kb