title: DNS query in JAVA
body: <p>I am messing around with DNS services in Java - I am specifically trying to lookup all google.com addresses and display them in an array, similar to running a lookup using nslookup:</p>
  
  <pre><code>nslookup -q=TXT _netblocks.google.com 8.8.8.8
  </code></pre>
  
  <p>I am using <code>InetAddress</code> for this but keep on getting exception errors. Since the errors refer to 'Unknown Host' I don't think <code>InetAddress</code> can read TXT records (if I use google.com it works, but that does't show the full IP Range). Below is my code:</p>
  
  <pre><code>InetAddress dnsresult[] = InetAddress.getAllByName("_netblocks.google.com");
              for (int i=0; i&lt;dnsresult.length; i++)
              System.out.println (dnsresult[i]);
  </code></pre>
  
  <p>Would appreciate it if someone can point me in the right direction. </p>
  
  <p>-JK</p>