[jcifs] How to list all computers in LAN?

Michael B Allen miallen at ioplex.com
Thu Sep 20 06:32:46 GMT 2007

On Thu, 20 Sep 2007 09:05:23 +0700
Jakov <giaodichdientu at gmail.com> wrote:

> Hi there,
> To answer the question, how to list all computers in the LAN, many people
> told me that I should use JCIFS. I checked all examples in jcifs-1.1.11.tgz.
> Looks like there's a file that could help: CheckAllDC.java with
> NbtAddress.getAllByName() function. But I couldn't make it work. The error
> is "java.net.UnknownHostException" with all host I gave it.
> My LAN has many domains, each has many computers. How could I list all of
> them using JCIFS? Please give me a hint.

SmbFile[] domains = (new SmbFile("smb://")).listFiles();
for (int i = 0; i < domains.length; i++) {
	SmbFile[] servers = domains[i].listFiles();
	for (int j = 0; j < server.length; j++) {

More information about the jcifs mailing list