[jcifs] SmbFile.exists()

The DJ hartman at mac.com
Wed Nov 7 19:24:24 EST 2001

> I am trying to check to see if a connection has been made using an
> SmbFile, but the exists() method always returns true.  What is going on?
To not distract Mike, I'll Forward you his answer from what seems to be the
same question several days ago.

- Fowarded Message -

> This is a bug. IP addresses do not trigger a network lookup. Using Java's
> InetAddress (after which NbtAddress is modeled) there would be no
> elegant way to tell if the host "exists" other than trying to open a
> connection to it. Even though IP addresses slip though the name service code
> NetBIOS has a Node Status operation that can _usually_ test to see if the host
> is
> really alive. This is easily fixed (already have in my 0.6 dev) by
> changing jcifs/smb/SmbFile.exists from:
> else {
>   NbtAddress.getByName( url.server, 0x20, null );
> to
> else {
>   NbtAddress.getByName( url.server, 0x20, null ).getHostName();
> Meanwhile you can do precisely the same thing with:
>   NbtAddress.getAllByAddress( "" );.
> Not sure if this is worth a 0.5.2 at the moment. I guess there was the
> "File Locking Redux" bug too but still I donno, I'm doing some serious
> jCIFS surgery right now. Don't distract me :~)
> Thanks,
> Mike
Universiteit Twente
Derk-Jan 'The DJ' Hartman
ICQnr: 10111559
Mail:  mailto:hartman at mac.com
WWW:   http://home.student.utwente.nl/d.hartman/
Goto:  http://www.student.utwente.nl/~macsatcampus

More information about the jcifs mailing list