Lan - Computer Names

I want to create a combobox which shall contain the names of the computers in the lan.How can I get these names?Are there any classes specifically for lan?How can I achive this?Thank you.Manu
[240 byte] By [manu176] at [2007-9-26 2:36:44]
# 1

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

neville_sequeira at 2007-6-29 10:04:58 > top of Java-index,Archived Forums,Socket Programming...
# 2

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?

migG at 2007-6-29 10:04:58 > top of Java-index,Archived Forums,Socket Programming...
# 3
Yes,it does work!If you want to do a reverse dns lookup on 62.168.28.217, you should query like below:Attributes attr = ctx.getAttributes("217.168.28.62.IN-ADDR.ARPA",new String[]{"PTR"});
huzuih at 2007-6-29 10:04:58 > top of Java-index,Archived Forums,Socket Programming...
# 4
See if this helps http://www.dnsjava.org/
FarukMKhan at 2007-6-29 10:04:58 > top of Java-index,Archived Forums,Socket Programming...
# 5

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!

Markus_Tomasek at 2007-6-29 10:04:58 > top of Java-index,Archived Forums,Socket Programming...