[jcifs] List many workgroups/domains
Michael B Allen
ioplex at gmail.com
Wed Feb 29 07:52:39 MST 2012
On Tue, Feb 28, 2012 at 1:34 PM, rmillet <rmillet42+jcifs at gmail.com> wrote:
> I have some issue when I want to list all domains and workgroups on my
> - I have one domain controller (Windows 2008) and one workstation (Windows
> XP) on the domain MYDOMAIN.
> - I boot a debian on the workgroup MYWORKGROUP,
> and then (a few minutes after debian is up) I do:
> new SmbFile("smb://").listfiles();
> which only returns MYWORKGROUP.
> tcpdump shows that both debian and windows XP answer to the MSBROWSE query,
> but only debian is asked for known domains.
> Both workgroup and domain are returned when I wait several minutes after
> debian is up.
> Is there a way to force listfiles to ask all master browser servers, because
> I can't rely on the "stability" of my network (many workgroups, many
> computers often connected/disconnected) ?
Not using the stock code no. The way master browsers are found is to
broadcast a query for a special binary name
"\u0001\u0002__MSBROWSE__\u0002". JCIFS just uses the first one to
respond. In theory you could add a routine to SmbFile.java that
collected all master browsers and called doNetServerEnum on each to
make a composite list of servers.
But note that the browser service is used less and less over time. It
really is something left over from the Windows NT days. I don't think
newer Windows clients use NetBIOS. Maybe XP.
Michael B Allen
Java Active Directory Integration
More information about the jCIFS