high volume/speed gethostbyaddr how?
brueckd at tbye.com
brueckd at tbye.com
Fri May 3 13:48:18 EDT 2002
On Fri, 3 May 2002 brueckd at tbye.com wrote:
> import threading, socket
> ipList = [... create a list of IP addresses ...]
> ipAndHostList = []
>
> def LookupThread():
> while 1:
> try:
> ip = ipList.pop()
> ipAndHostList.append((ip, socket.gethostbyaddr(ip)[0]))
> except IndexError:
> break
>
> for i in range(3):
> threading.Thread(target=LookupThread).start()
Oops, also add:
import time
while ipList:
time.sleep(0.1)
:-)
More information about the Python-list
mailing list