[jcifs] How to list all computers in LAN?
Andre Li
ndrli at yahoo.com
Tue Jun 28 21:50:38 MDT 2011
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);
> }
>}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20110628/2540c32d/attachment.html>
More information about the jCIFS
mailing list