high volume/speed gethostbyaddr how?
Dan Polak
systhree at nospam.mailandnews.com
Sat May 4 09:27:17 EDT 2002
In article <mailman.1020445267.30722.python-list at python.org>,
brueckd at tbye.com says...
> 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)
I tried it and it improves speed greatly.
Thank you very much!
Dan
More information about the Python-list
mailing list