Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Foolproof way to check if a domain exists? (http://www.velocityreviews.com/forums/t959393-foolproof-way-to-check-if-a-domain-exists.html)

laredotornado@zipmail.com 04-04-2013 02:17 PM

Foolproof way to check if a domain exists?
 
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

Roedy Green 04-04-2013 03:32 PM

Re: Foolproof way to check if a domain exists?
 
On Thu, 4 Apr 2013 07:17:33 -0700 (PDT), laredotornado@zipmail.com
wrote, quoted or indirectly quoted someone who said :

>
>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

laredotornado@zipmail.com 04-04-2013 04:21 PM

Re: Foolproof way to check if a domain exists?
 
On Thursday, April 4, 2013 10:32:15 AM UTC-5, Roedy Green wrote:
> On Thu, 4 Apr 2013 07:17:33 -0700 (PDT), laredotornado@zipmail.com
>
> wrote, quoted or indirectly quoted someone who said :
>
>
>
> >

>
> >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


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

Joerg Meier 04-04-2013 07:59 PM

Re: Foolproof way to check if a domain exists?
 
On Thu, 4 Apr 2013 07:17:33 -0700 (PDT), laredotornado@zipmail.com wrote:

> 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.namese rvers", "8.8.8.8");
System.setProperty("sun.net.spi.nameservice.provid er.1", "dns,sun");

Liebe Gruesse,
Joerg

--
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.

Arne Vajh?j 04-04-2013 08:53 PM

Re: Foolproof way to check if a domain exists?
 
On 4/4/2013 12:21 PM, laredotornado@zipmail.com wrote:
> On Thursday, April 4, 2013 10:32:15 AM UTC-5, Roedy Green wrote:
>> On Thu, 4 Apr 2013 07:17:33 -0700 (PDT), laredotornado@zipmail.com
>> wrote, quoted or indirectly quoted someone who said :
>>> 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


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


http://commons.apache.org/proper/com...oisClient.html

Arne




All times are GMT. The time now is 01:22 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.