Results 1 to 3 of 3
Thread: FTP Client
- 01-21-2012, 11:17 AM #1
Member
- Join Date
- Apr 2011
- Posts
- 4
- Rep Power
- 0
FTP Client
I am trying to make a connection to FTP server through java code
import java.io.IOException;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
public class FTPClass {
public static void main(String[] args) throws IOException {
FTPClient ftp = new FTPClient();
ftp.connect("ftp://41.215.1.22/store");
ftp.login("", "");
int reply = ftp.getReplyCode();
if (FTPReply.isPositiveCompletion(reply)) {
System.out.println("Connected Success");
} else {
System.out.println("Connection Failed");
ftp.disconnect();
}
}
but i keep getting the error below: Exception in thread "main" java.net.UnknownHostException: ftp://41.215.1.22/store/
Is it to do with the use of IP instead of a server name? What is way out if I still want to use the IP address?
Please someone help me.
MutuaLast edited by kakinyim; 01-21-2012 at 12:26 PM.
- 01-21-2012, 12:46 PM #2
Re: FTP Client
How do you know that the IP address is a valid address?
Does it work in other programs?
- 01-23-2012, 11:24 AM #3
Re: FTP Client
Is the FTPServer installed correctly ? have you checked to connect it manually (not from Java code) using any of the software .. As far as I know only the IP address is enough in the connect method .. if it has authentication required then after connect we call the login method.
warm regards
Vinod M_______________________________________________
give me beans .........
Similar Threads
-
TCP Two-Client-Server/Client Program not doing what I expected
By xenoepist in forum Advanced JavaReplies: 6Last Post: 01-09-2012, 09:30 PM -
Exceptions on client connections after a client crash
By Negrini in forum NetworkingReplies: 0Last Post: 06-27-2011, 04:39 PM -
Datagram Client and Server, client timer question
By saru88 in forum NetworkingReplies: 1Last Post: 10-05-2008, 03:12 PM -
Identify Client in Socket Client Server Application
By masadjie in forum NetworkingReplies: 1Last Post: 12-20-2007, 09:18 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks