[jcifs] SmbFile exists()

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Wed Oct 31 13:41:02 EST 2001


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( "129.2.205.188" );.

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


> -----Original Message-----
> From:	Newman [SMTP:diputs_mai at yahoo.com]
> Sent:	Tuesday, October 30, 2001 9:17 PM
> To:	jcifs at samba.org
> Subject:	[jcifs] SmbFile  exists()
> 
> when exists() is called on a valid url but the
> piticular computer is down exists still returns true.
> 
> ex
> 
> SmbFile hostpc = null;
> try{hostpc = new
> SmbFile("smb://129.2.205.188");}catch(Exception
> e){System.err.println(e);System.exit(1);}
> if(hostpc.exists())
> {System.out.println("computer exists");} 
> 
> if 129.2.205.188 is off line "computer exists" still
> prints.
> 
> -newman
> 
> __________________________________________________
> Do You Yahoo!?
> Make a great connection at Yahoo! Personals.
> http://personals.yahoo.com
> 





More information about the jcifs mailing list