Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Sockets and Internet Protocols and the fly likes sloowwwww  Reverse DNS lookup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "sloowwwww  Reverse DNS lookup" Watch "sloowwwww  Reverse DNS lookup" New topic

sloowwwww Reverse DNS lookup

Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Here is my simple code:

I understand that there is no guarantee that this will return a proper host name. For some ip addresses, this takes a ridiculously long time to return, often with just the same ip address I put in. Other ip addresses are faster. Meanwhile, netstat from the command line returns all IP addresses instantly.

So I have three questions:
1) InetAddress API says that it uses a "System Configured lookup setting" to resolve the ip address to a host name. what settting would this be?
2) Why do some ip addresses take longer than others?
3) How does netstat get this same information so much faster?

I am loking through the SIGAR code for their netstat implementation and it just uses something similar to what I put above.
I agree. Here's the link:
subject: sloowwwww Reverse DNS lookup
It's not a secret anymore!