Hi,
I need to connect to ftp and get the names of the files...
But am getting an UnknownHostException when i gave the ip..
Following is my code
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.io.FileUtils;
import java.io.IOException;
public class FtpTest {
public static void main(String[] args) {
try{
FTPClient client = new FTPClient();
client.connect("ftp.111.111.111.111");
client.disconnect();
}
catch(Exception e){
e.printStackTrace();
}
}
}
My IP is different than what i mentioned above..
Am getting the following error...
java.net.UnknownHostException: ftp.111.111.111.111
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at java.net.Socket.<init>(Socket.java:372)
at java.net.Socket.<init>(Socket.java:186)
at org.apache.commons.net.DefaultSocketFactory.createSocket(DefaultSocketFactory.java:52)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:161)
at org.apache.commons.net.SocketClient.connect(SocketClient.java:249)
at FtpTest.main(FtpTest.java:12)
Pls Help :sad:
Thanks in Advance :)