Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

[JAVA] FTP Code

Options
  • 29-03-2006 1:07am
    #1
    Registered Users Posts: 9,225 ✭✭✭


    Hey everybody, yup i've hit a brick wall once again!!

    Does anyone know an easy way to use FTP in java, I am currently using J-FTP and it keeps stalling after the password is confirmed, am i doing something wrong or whats going on?
    boolean isThere = false;
    		// boolean transfered=false;
    		
    		// Log.setLogger(this);
    		FtpConnection con = new FtpConnection("ftp.******.net");
    		ConnectionHandler handler = new ConnectionHandler();
    		// con.addConnectionListener(this);
    
    		con.setConnectionHandler(handler);
    
    		con.login("project","project");
    
    		while(!isThere)
    		{
    			try { Thread.sleep(10); }
    			catch(Exception ex) { ex.printStackTrace(); }
    		}
    
    		// con.chdir("/www/fyp");
    
    		con.upload("data.xml"); 
                   //this file is in the same dir as the class
    

    and this is what I am getting:
    no property file loaded, using defaults... (java.io.FileNotFoundException: /Users/rossmulcahy/.jftp/jftp.properties (No such file or directory))
    Connecting to ftp.*******.net
    
    > Connecting to ftp.*******.net
    220 Servage.net FTP server #1
    
    > 220 *******.net FTP server #1
    Connection established...
    
    > Connection established...
    > USER project
    
    > > USER project
    331 Password required for project.
    
    > 331 Password required for project.
    > PASS ****
    
    > > PASS ****
    230 User project logged in.
    
    > 230 User project logged in.
    Logged in...
    
    > Logged in...
    > SYST
    
    > > SYST
    215 UNIX Type: L8
    
    > 215 UNIX Type: L8
    > TYPE I
    
    > > TYPE I
    200 Type set to I
    
    > 200 Type set to I
    > PWD
    
    > > PWD
    257 "/" is current directory.
    
    > 257 "/" is current directory.
    
    and it just stalls there!?!

    once again if anyone has any experience with this any help at all would be very much appreciated. You've all been a great help so far, and i hope i can start returning the favour soon (although with the state of my programming "skills" i'm not sure how much help i can be!!).

    Thanks

    Call_Me_Al


Comments

  • Registered Users Posts: 1,996 ✭✭✭lynchie


    and it just stalls there!?!
    Have you checked your infinite while loop? How does it get out of it? Who modifies "isThere" so it can break out from the loop?


Advertisement