See if this helps you in any way. It is a program I have written to list hosts in a domain. It uses DNS Service Provider for the Java Naming Directory Interface...
import javax.naming.*;
import javax.naming.directory.*;
import java.util.*;
public class DNSTest
{
public static void main(String[] args)
{
try {
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial", "com.sun.jndi.dns.DnsContextFactory");
DirContext ictx = new InitialDirContext(env);
NamingEnumeration hostEnumeration = ictx.list("dns://ns.hyperreal.org/apache.org");
System.out.println("Hosts in the apache.org domain are...");
while(hostEnumeration.hasMore()) {
System.out.println(((NameClassPair) hostEnumeration.next()).getName() + ".apache.org");
}
ictx.close();
} catch(Exception e) {
e.printStackTrace();
}
}
}
You can download the DNS service provider from http://developer.java.sun.com/developer/earlyAccess/jndi
I am trying out that jndi/DNS provider and would like to get reverse-DNS like capability. Any idea why this does not work:
Attributes attrs1 = ictx.getAttributes("192.18.97.71.IN-ADDR.ARPA", new String[] {"PTR"});
where I wish to get the Fully Qualified Domain Name, providing the IP address (specified in reverse above; according to RFC 1034 this would seem to be a PRT record request.
Any ideas how to use this API to get fqdn, given IP address of the host?
sorry for pushing this topic up, but this here is exactly my problem!
i want to do something like this checkboxes, so i need the names of the computers in my lan, but where the hell do i get the right path for the dns out? i made a tracert to my dns server, and i can also get out the domains of this dns server, but there are hundrits of domains! and i can't look in everyone of them.....
is there any method to get out the full path to/from my dns server? so that this little programm really just returns the names of the computers in MY lan? Or do i have to call my dns-provider.....and will he give me this information? or is it forbitten for him to tell me that?
thanks for help!