Results 1 to 3 of 3

Thread: FTP Client

  1. #1
    kakinyim is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default 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.

    Mutua
    Last edited by kakinyim; 01-21-2012 at 12:26 PM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,406
    Rep Power
    25

    Default Re: FTP Client

    How do you know that the IP address is a valid address?
    Does it work in other programs?

  3. #3
    Join Date
    Jul 2010
    Location
    India
    Posts
    58
    Rep Power
    0

    Default 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

  1. Replies: 6
    Last Post: 01-09-2012, 09:30 PM
  2. Replies: 0
    Last Post: 06-27-2011, 04:39 PM
  3. Replies: 1
    Last Post: 10-05-2008, 03:12 PM
  4. Identify Client in Socket Client Server Application
    By masadjie in forum Networking
    Replies: 1
    Last Post: 12-20-2007, 09:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •