Java – sharing under IP

How do I list all available shared folders under a specific IP address?

Analog code:

IP ip = new IP("10.0.0.9");

for(File share : ip.getSharedFolders){
    System.out.println(share.getName());
}

Is there any way to achieve this goal?

I want to make something similar to Windows Web browser. I need to get all shared folders under a specific IP so that I can generate a tree

Using the first level shared folder, I can easily get such a lower level

for(File f : new File("//10.0.0.9/d").listFiles()){
                    System.out.println(f.getName());

Solution

You can use the Java CIFS client library to get a list of shares, especially smbfile List method Here is a small example of how to use this API:

SmbFile server = new SmbFile("smb://server/");
String[] shares = server.list();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>