[jcifs] SmbFile.listFiles() on own server takes a long time

Michael B. Allen miallen at eskimo.com
Mon Sep 30 14:46:36 EST 2002


On Mon, 30 Sep 2002 11:31:46 +1000
"Kid Kalanon" <kid_kalanon at hotmail.com> wrote:

> > > the output looks like (the actual names have been removed to protect the
> > > innocent):
> > >
> > > smb://host1 listFiles() took 0 milliseconds
> >
> >Wow, that's pretty fast. Urr, a little too fast actually.
> >
> 
> Yeah, I forgot to mention that all these listFiles calls would have caused 
> SmbAuthException because I didn't set and login stuff.  But the point I 
> wanted to make was name lookup failure.
> 
> > > smb://host2 listFiles() took 47 milliseconds
> > > smb://host3 listFiles() took 0 milliseconds
> > > smb://host4 listFiles() took 6000 milliseconds
> >
> >This is a name service lookup timeout. If you ex.printStackTrace()
> >you'll see that it's failing to lookup host4.
> >
> 
> Yes, it did time out but it wouldn't have thrown an exception.  It would go 
> on to the next thing in the resolve order - the default was RESOLVER_DNS and 
> the call to InetAddress.getByName was successful.  So the call to listFiles 
> was actually successful but it took a long time.

Then    it    would    have    returned   right   away.   You   must   have
resolveOrder=BCAST,DNS  at  least  because  it's  trying  (and  failing) to
resolve the name using BCAST first. 

> > > smb://host5 listFiles() took 0 milliseconds
> > > smb://host6 listFiles() took 15 milliseconds
> > >
> > > I am on a LAN with usually 5 to 6 computers running either Windows 2000 
> >or
> > > Windows NT and all on the same workgroup.  There are no Linux or Unix 
> >boxes
> > > on the LAN.  As you can see, host4 is the culprit and that's the 
> >computer I
> > > just run the above code on.
> >
> >This sounds related to the WINs resolution problem just discussed. In
> >this case however I think you should be able to broadcast a name service
> >lookup to yourself. Weird. Can you send me a -Dlog=ALL trace of that?
> >
> 
> Yes, I just read that after I sent that out :)  like the host doesn't know 
> it's own IP, etc.   But I don't think I have a WINS (server or service) 
> running anywhere on the network.
> 
> The log was slightly long for the last bit of code.  I've attached the log 
> for the following code:
> 
>   public static void main(String[] argv) throws Exception
>   {
>     SmbFile workgroup = new SmbFile("smb://p4-2000");
>     SmbFile[] servers = workgroup.listFiles();
>   }

This  is  timing out on the broadcast lookup and they getting Access denied
trying  to  list  shares.  Relax  your permissions or use an account on the
machine.  You  could use the jcifs.netbios.lmhosts option to get around the
broadcast  failure  (although it is strange that it's failing to respond to
that).

-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and more importantly to tasks that have not
yet been conceived. 



More information about the jcifs mailing list