[jcifs] How to list all computers in LAN?

Andre Li ndrli at yahoo.com
Wed Jun 29 10:50:10 MDT 2011


Does that mean Samba is going to be phased out?

Meanwhile, I still want to use it. Is there any thing I can do to make it work today?
Thanks.




________________________________
From: Christopher R. Hertel <crh at ubiqx.mn.org>
To: Andre Li <ndrli at yahoo.com>
Cc: "jcifs at lists.samba.org" <jcifs at lists.samba.org>
Sent: Tuesday, June 28, 2011 9:32 PM
Subject: Re: [jcifs] How to list all computers in LAN?

Andre, and anyone else who is listening.

Before working out the bugs in the method you are using, it would be very
beneficial to understand exactly what it is that this method is trying to
accomplish.

It is looking for all nodes within the broadcast domain that are running the
NetBIOS over TCP (NBT) NetBIOS Name Service that are *also* local master
browsers for their workgroup/NT-domain *and* are willing to respond to
broadcast queries.

That was never a reliable way to find all of the nodes on a LAN, and it is
becoming less so as Microsoft phases out use of the NBT transport.

Chris -)-----

Andre Li wrote:
> Hi All,
> 
> I tried:
> 
> 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++) {
>         System.out.println(server);
>     }
> }
> 
> But got error:
> java.net.UnknownHostException: ..__MSBROWSE__.<01>
>     at jcifs.netbios.NbtAddress.doNameQuery(NbtAddress.java:317)
>     at jcifs.netbios.NbtAddress.getByName(NbtAddress.java:422)
>     at jcifs.netbios.NbtAddress.getByName(NbtAddress.java:403)
>     at jcifs.smb.SmbFile.getFirstAddress(SmbFile.java:845)
>     at jcifs.smb.SmbFile.connect(SmbFile.java:946)
>     at jcifs.smb.SmbFile.connect0(SmbFile.java:875)
>     at jcifs.smb.SmbFile.doNetServerEnum(SmbFile.java:1907)
>     at jcifs.smb.SmbFile.doEnum(SmbFile.java:1727)
>     at jcifs.smb.SmbFile.listFiles(SmbFile.java:1708)
>     at jcifs.smb.SmbFile.listFiles(SmbFile.java:1641)
>     at J.main(J.java:10)
> When
>   SmbFile[] domains = (new SmbFile("smb://")).listFiles();
> was called.
> 
> Do I need to initialize/configure the system? How?
> 
> Any information would be appreciated. Thanks in advance.
> 
> 
>>Michael B Allen miallen at ioplex.com
>>Thu Sep 20 06:32:46 GMT 2007
>>
>>    Previous message: [jcifs] How to list all computers in LAN?
>>    Next message: [jcifs] How to list all computers in LAN?
>>    Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>
>>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++) {
>>        System.out.println(server);
>>    }
>>}

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----  crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----  crh at ubiqx.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20110629/63968e14/attachment-0001.html>


More information about the jCIFS mailing list