• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

dns monitoring using java query

Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,
I am trying to monitor dns using java .
1 >First I need to find the DNS host based on the domain name :
Here is the code I have written :

This returns hostnames like ns4.yahoo.com.

Please let me know if this is the correct way of getting DNSHost ?

2 >
Given a DNS host and port no - am supposed to check for DNS monitoring .

I am writing the following code :

Is this code correct - am I supposed to use http protocol ?
Any ideas and thoughts are welcome .

Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why you're monitoring DNS needs more elaboration.

1. If you're trying to detect that DNS is returning a valid hostname, the first part of your example fulfills that objective.

2. If you're trying to detect the life of a DNS based host, you're much better off relying on an ICMP ping instead of using heavy top-level protocols like HTTP which in themselves could fail.

3. If you only care about detecting that the HTTP server on such named host is alive, then the second part of your post would probably be sufficient, through HTTP servers can be quite broken but still respond to a client. Once again, it all depends on what you mean by 'DNS monitoring'.

PS: The naming framework in java might not be the best solution for low level DNS solutions. A cursory look at google found dnsjava, which is a client that is specifically designed for high and low level DNS resolution. If you really care about DNS, and not so much the reachability of the results, you may want to look at this library.
This will take every ounce of my mental strength! All for a tiny ad:
Garden Master Course kickstarter
    Bookmark Topic Watch Topic
  • New Topic