12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
建站问答 时间:2024-12-01 19:09:36
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
python中实现单线程绑定域名解析,具体方法如下:import timeimport socketdef ReadHost(file): hosts=[] ... return hostsdef SynResolve(fr): hosts=ReadHost(fr
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
python中实现单线程绑定域名解析,具体方法如下:
import time
import socket
def ReadHost(file):
hosts=[]
...
return hosts
def SynResolve(fr):
hosts=ReadHost(fr)
IPs={}
for host in hosts:
try:
results=socket.getaddrinfo(host,None)
for result in results:
print host, result[4][0]
IPs[result[4][0]]=host
except Exception,e:
print e
file.close()
if __name__=='__main__':
start=time.time()
print 'starting at: ',start
SynResolve('host')
print 'ending at: ',time.time()-start
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19