jcifs.smb.SmbException:连接失败:0.0.0.0<;00>/192.168.43.103 jcifs.util.transport.TransportException java.net.SocketException
当我试图读取jcifs.smb.SmbException:连接失败:0.0.0.0<;00>/192.168.43.103 jcifs.util.transport.TransportException java.net.SocketException,java,sockets,samba,smb,Java,Sockets,Samba,Smb,当我试图读取smb文件时,出现此错误 PS 它说我的smb1已启用,但我仍然收到此错误 package shared_folder; import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.SmbException; import jcifs.smb.SmbFile; import java.net.MalformedURLException; public class Main { public static vo
smb
文件时,出现此错误
PS
它说我的smb1
已启用,但我仍然收到此错误
package shared_folder;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
import java.net.MalformedURLException;
public class Main {
public static void main(String[] args) {
String url = "smb://192.168.43.103/shared/";
String userName = "shyam";
String password = "shyam";
String domain = null;
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, userName, password);
try {
doRecursiveLookup(new SmbFile(url, auth));
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
/*
* Recursively scans through the folder for files and prints the name of folder and file
*/
public static void doRecursiveLookup(SmbFile smb) {
try {
if (smb.isDirectory()) {
System.out.println(smb.getName());
for (SmbFile f : smb.listFiles()) {
if (f.isDirectory()) {
doRecursiveLookup(f);
} else {
System.out.println("\t:" + f.getName());
}
}
} else {
System.out.println("\t:" + smb.getName());
}
} catch (SmbException e) {
e.printStackTrace();
}
}
}
package shared_folder;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbException;
import jcifs.smb.SmbFile;
import java.net.MalformedURLException;
public class Main {
public static void main(String[] args) {
String url = "smb://192.168.43.103/shared/";
String userName = "shyam";
String password = "shyam";
String domain = null;
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, userName, password);
try {
doRecursiveLookup(new SmbFile(url, auth));
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
/*
* Recursively scans through the folder for files and prints the name of folder and file
*/
public static void doRecursiveLookup(SmbFile smb) {
try {
if (smb.isDirectory()) {
System.out.println(smb.getName());
for (SmbFile f : smb.listFiles()) {
if (f.isDirectory()) {
doRecursiveLookup(f);
} else {
System.out.println("\t:" + f.getName());
}
}
} else {
System.out.println("\t:" + smb.getName());
}
} catch (SmbException e) {
e.printStackTrace();
}
}
}