Re: Resolving IP address to domain name?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



mayayana said....
Well, then again.........

Although these both worked, the show stopper is that they both stall for
an
annoying period of time when there is no reverse DNS for an IP address.
[SNIP}

It's a simple, primitive version of what you
want to do, using gethostbyaddr from ws2_32.dll.
(I think it works on all systems from Win98 up.)

I wrote it for processing my own
server logs. Earthlink hosts my site and a few
years ago they decided to discontinue the courtesy
of resolving the IPs in the server logs. So I wrote
a little utility that I use to occasionally get a better
idea of where people are coming from.

I don't remember, offhand,
whether I added an option to control the timeout
when not getting a response, or whether that's
even possible. But it works fine for me. I process
1-2 MB logs and it takes, typically, about 10
minutes. (Nearly all of that time is waiting for
non-repsonders.)


Thanks for that. I lifted the relevant part and plugged it into my
program. To my dismay I discovered that it was as slow as ever, stalling
with each non-resolving address. But then I found that logging those
addresses and then skipping over them when they reoccur is the key. That
brought the time down to five minutes. I then saved that accumulated list
of bad addresses for reloading the next time the program is run, bringing
the execution time for that test log down to less than 8 seconds. Any new
ones turning up are appended to the list.

I can live with that.

Thanks again.

--

Dale Beckett
.



Relevant Pages

  • Re: What browsers are you using?
    ... I beg to differ, but my server logs show people still using IE on the ...
    (comp.infosystems.www.browsers.mac)
  • Re: Connection Attempts
    ... Jeremy Hoover wrote: ... > Today I was going through my server logs. ... And remember not to take legal advice from random ...
    (Incidents)