Foolproof way to check if a domain exists?

L

laredotornado

Hi,

We're using Java 6. We are trying to use the following code to determine if a domain exists:

????????????InetAddress inetHost = InetAddress.getByName(domain);
????????????String hostName = inetHost.getHostName();

This usually works fine -- if a domain doesn't exist, an "UnknownHostException" is thrown. However, we notice this isn't true for the Verizon ISP. Instead hostname is equal to the domain (e.g. "locohost") that doesn't exist.. Therefore, it is hard to tell what exists and what doesn't.

Is there a more foolproof way to verify the existence of a domain?

Thanks, - Dave
 
R

Roedy Green

Is there a more foolproof way to verify the existence of a domain?

there are various WHOIS services you could probe. They will tell you a
domain exists if it is registered, even if no server is handling it
currently.
see http://mindprod.com/jgloss/whois.html
--
Roedy Green Canadian Mind Products http://mindprod.com
Motors make noise, and that tells you about the feelings and attitudes
that went into it. Something was more important than sensory pleasure --
nobody would invent a chair or dish that smelled bad or that made horrible
noises -- why were motors invented noisy? How could they possibly be
considered complete or successful inventions with this glaring defect?
Unless, of course, the aggressive, hostile, assaultive sound actually served
to express some impulse of the owner.
~ Philip Slater (born: 1927 age: 85)
The Wayward Gate: Science and the Supernatural
 
L

laredotornado

there are various WHOIS services you could probe. They will tell you a

domain exists if it is registered, even if no server is handling it

currently.

see http://mindprod.com/jgloss/whois.html

--

Roedy Green Canadian Mind Products http://mindprod.com

Motors make noise, and that tells you about the feelings and attitudes

that went into it. Something was more important than sensory pleasure --

nobody would invent a chair or dish that smelled bad or that made horrible

noises -- why were motors invented noisy? How could they possibly be

considered complete or successful inventions with this glaring defect?

Unless, of course, the aggressive, hostile, assaultive sound actually served

to express some impulse of the owner.

~ Philip Slater (born: 1927 age: 85)

The Wayward Gate: Science and the Supernatural

Are there Java interfaces for these services? Ideally, I'd like something platform independent. - Dave
 
J

Joerg Meier

We're using Java 6. We are trying to use the following code to determine if a domain exists:
????????????InetAddress inetHost = InetAddress.getByName(domain);
????????????String hostName = inetHost.getHostName();
This usually works fine -- if a domain doesn't exist, an "UnknownHostException" is thrown. However, we notice this isn't true for the Verizon ISP. Instead hostname is equal to the domain (e.g. "locohost") that doesn't exist. Therefore, it is hard to tell what exists and what doesn't.
Is there a more foolproof way to verify the existence of a domain?

My guess would be that Verizon's DNS is faulty and is responding with a
page filled with ads or some such nonsense. Do try a better DNS such as
Googles at 8.8.8.8. If you run the following BEFORE doing anything else in
your code, you might have the platform independent solution you are looking
for:

System.setProperty("sun.net.spi.nameservice.nameservers", "8.8.8.8");
System.setProperty("sun.net.spi.nameservice.provider.1", "dns,sun");

Liebe Gruesse,
Joerg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top