0
나는 그것을 잘 작동 파이어 폭스를 사용하여 연결하면 FTP 서버를 아파치 평민은 FTP
을 만들 CrossFTP을 사용했다. 아파치 평민을 사용하는 경우
는하지만 예외를
import java.net.SocketException;
import org.apache.commons.net.ftp.FTPClient;
import java.io.IOException;
public class FtpConnectDemo {
public static void main(String[] args) throws SocketException, IOException {
FTPClient client = new FTPClient();
client.connect("ftp://192.168.1.150");
boolean login = client.login("ehab01", "CD7IZW0O");
if (login) {
System.out.println("Login success...");
boolean logout = client.logout();
if (logout) {
System.out.println("Logout from FTP server...");
}
} else {
System.out.println("Login fail...");
}
client.disconnect();
}
}
Exception in thread "main" java.net.UnknownHostException: ftp://192.168.1.150
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:849)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1200)
at java.net.InetAddress.getAllByName0(InetAddress.java:1153)
at java.net.InetAddress.getAllByName(InetAddress.java:1083)
at java.net.InetAddress.getAllByName(InetAddress.java:1019)
at java.net.InetAddress.getByName(InetAddress.java:969)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:184)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:273)
at com.ftp.FtpConnectDemo.main(FtpConnectDemo.java:19)
잘 작동합니다. –