[jcifs] New Guy: Probably A Very Common Question

C.Andy c.andy at mchsi.com
Sun Apr 17 18:02:47 MDT 2011


I have used JCIFS to successfully connect to devices through Smb. What I am
looking for at this point is a Network Browse or Network Scan feature that
is generic and locates networks shares that are available on a LAN/WAN
through a router much like Network Neighborhood on a windows platform does.

I have seen recommendations to use SmbFile("smb://").listFiles(); but when
implemented I get an smb exception "2302" on the listFiles() call. Also, it
is my understanding that this method accesses the Master Browse file which
is more or less deprecated so the usefulness of this method across
uncontrolled/unknown networks seems like a bad idea. Maybe this is the
appropriate way to go about the project but I am lost at this point. 

I've also seen references to the crawler example files. These files seem to
work if you already know what the share host IP is. I am looking for a
solution to "find" the available networks.

So, I went brute force. I pulled the IP address of the device trying to scan
the network (ex 192.168.2.5), dropped the last number (192.168.2.) and walk
a counter up through a loop and try to connect to each ip from 0 to 255.
This works but unfortunately this takes about 6 sec per iteration on
average. I was hoping the .exists() would make the iteration quick but it
seems it always returns "true" even though there are only currently 3
devices on the network. 

I apologize for asking something so trivial in advance. I am sure there is a
piece of the puzzle I do not have and would appreciate the fill in.

(And I did attempt to find the answer to my question through a search. This
is about the 30th tab on the top of my browser and 3 days worth of research.
Again, I apologize if you're tired of answering this common question.)

Any specifics that can push me in the right direction would be appreciated!

Thank you in advance!

--
View this message in context: http://samba.2283325.n4.nabble.com/New-Guy-Probably-A-Very-Common-Question-tp3456316p3456316.html
Sent from the Samba - jcifs mailing list archive at Nabble.com.


More information about the jCIFS mailing list