Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nslookup in Java

 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,
I'm doing a program in JSP and MySQL. The client is a Webhosting company. They want to check for the domain availability for registering the website thru their site.

for egs : nslookup www.aravindprasad.com should result the domain is available for registering
nslookup www.javaranch.com should result the domain is already registered.

Please help me to do this in Java. How can I start the coding in Java for this. Please send me some links which can help me.

Thanks in advance

regards

Aravind Prasad
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not post the same question in multiple forums. It causes confusion and duplication of effort as the community tries to help everyone.
 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for posting the doubt in different forums.
When i tried to post in the other one JSP forum it showed me it was locked, So i thought it is Java Advanced and i posted again in this forum.

Please help me, I'm waiting for Java Gurus to reply and solve my problem

Thanks and regards

Aravind Prasad
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at InetAddress.getAllByName();
 
Aravind Prasad
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou very much Scott,
I got the result using this. I've writtend a code which I'm adding here.



Now when i run the code I'm getting the output like this



Can I get the output as 1 if the domain exists..

Please help me.. what changes I should do in the code so that I can get the result like 1 if domain exists

Thanks in Advance

regards
Aravind Prasad
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15281
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Ljava.net.InetAddress;@923e30

Did you look at the API documentation of the method InetAddress.getAllByName(...)? If you did, you would have seen that it returns an array of InetAddress objects. If you print that directly to the screen, you'll get the above. Please read the API documentation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic