[jcifs] Error when browsing workgroups

Jean Berniolles jeanberniolles at yahoo.fr
Sat Oct 7 16:53:11 GMT 2006


Hello,



I'd want to browse my local network to have some stats abouts the files it contains.

I have written this little piece of code:




    public static void main(String[] args) {
        try {
            SmbFile rootDirectory = new SmbFile("smb://");
            SmbFile[] listOfWorkgroups = rootDirectory.listFiles();
            for(int i = 0; i<listOfWorkgroups.length; i++) {
                try {
                    SmbFile[] workgroupDirectory = listOfWorkgroups[i].listFiles();
                    for(int j = 0; j<workgroupDirectory.length; j++) {
                        System.out.println("smb://"+listOfWorkgroups[i].getName()+workgroupDirectory[j].getName());
                    }
                } catch (SmbException e) {
                    System.err.println("Warning: workgroup \""+listOfWorkgroups[i].getName()+"\" not browsable.");
                    e.printStackTrace();
                }
            }   
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }  catch (SmbException e) {
            System.err.println("Fatal error: was not able to obtain list of workgroups.");
            System.err.println(e);
        }
    }


It should print a list of computer sharing files. I'd want to understand some of the errors I get when I list computers inside a workgroups :

Warning: workgroup "MSHOME/" not browsable.
jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password.
A password to have a list of computers ?



Warning: workgroup "WORKGROUP/" not browsable.
jcifs.smb.SmbException: 
jcifs.util.transport.TransportException: Connection timeout
Yes, there is something like 50+ workgroups for 500+ computers and there is 30 computers inside that one, but Windows take no time to browse the same workgroup.


Warning: workgroup "REZO/" not browsable.
jcifs.smb.SmbException: Failed to connect to server
java.net.UnknownHostException: REZO
    at jcifs.UniAddress.getByName(UniAddress.java:301)
WTF ?


And I have also some random:

java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)

Thanks you a lot to help me, thanks.

Jean




	

	
		
___________________________________________________________________________ 
Découvrez un nouveau moyen de poser toutes vos questions quel que soit le sujet ! 
Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos expériences. 
http://fr.answers.yahoo.com 
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list