jcifs lib传输在等待连接时断开连接

zbwhf8kr  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(257)

我试着在窗口10上列出共享文件夹中的文件这是代码。

try {
                    CIFSContext base = SingletonContext.getInstance();
                    CIFSContext authed1 = base.withAnonymousCredentials();

                    for(final NetworkScanner.serverBean Info : servers ) {
                        final String Url = "smb://" + Info.serverIp + "/";

                        try {
                            SmbFile f = new SmbFile(Url, authed1);
                            for (String sambafile : f.list()) {
                                    String file = (sambafile.subSequence(0, sambafile.length() - 1)).toString();
                                    smb.add( Info.serverIp + "/" + file);
                            }
                        } catch (SmbException sambaex) {
                            sambaex.printStackTrace();
                        }

                    }

                } catch (Exception e) {
                    e.printStackTrace();
                }

并且,windowserver上的smbfile返回这些错误。

2020-12-04 17:49:30.503 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err: jcifs.smb.SmbException: Transport disconnected while waiting for connection
2020-12-04 17:49:30.503 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at jcifs.smb.SmbTreeImpl.treeConnect(SmbTreeImpl.java:569)
2020-12-04 17:49:30.503 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at jcifs.smb.SmbTreeConnection.connectTree(SmbTreeConnection.java:617)
2020-12-04 17:49:30.503 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at jcifs.smb.SmbTreeConnection.connectHost(SmbTreeConnection.java:563)
2020-12-04 17:49:30.504 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at jcifs.smb.SmbTreeConnection.connectHost(SmbTreeConnection.java:484)
2020-12-04 17:49:30.504 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at jcifs.smb.SmbEnumerationUtil.doShareEnum(SmbEnumerationUtil.java:149)
2020-12-04 17:49:30.504 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at jcifs.smb.SmbEnumerationUtil.doEnum(SmbEnumerationUtil.java:222)
2020-12-04 17:49:30.504 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at jcifs.smb.SmbEnumerationUtil.list(SmbEnumerationUtil.java:247)
2020-12-04 17:49:30.504 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at jcifs.smb.SmbFile.list(SmbFile.java:1140)
2020-12-04 17:49:30.504 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at tv.formuler.service.gtv.networkstorage.search.FindSamba$1.run(FindSamba.java:53)
2020-12-04 17:49:30.504 5897-7263/tv.formuler.service.gtv.networkstorage W/System.err:     at java.lang.Thread.run(Thread.java:764)

我允许匿名登录到我的文件夹

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题