• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android FTP API UnkownHostException

bruno386

Lurker
Hi,

I'm experimenting with eclipse and adroid sdk target 1.6.


I am using it.sauronsoftware.ftp4j.FTPClient;





Code:
package bruno.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import it.sauronsoftware.ftp4j.FTPClient; //this is the ftp class





public class brunoactivity extends Activity {
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        try{
        FTPClient client = new FTPClient();
        client.connect("thestorythusfar.co.uk");
        client.login("....", ".....");
        client.upload(new java.io.File("C://test"));
        //client.disconnect(true);


        }


        catch (Exception e){
            e.printStackTrace();
            new AlertDialog.Builder(this)
            .setMessage(e.toString())
            .show();


    }
        
        
    }
    
    
}

The app fires up in the emulator and then loads however I always get unkown host exception (this is handled with the catch block) whenever it try to make the connection.


The emulator seems to be working fine,the browser app laods any web page so its not a problem with the connection to the net.

The ftp server is fine I use it from any ftp client all the time including console ftp's, no problem there.


Anyone got any ideas?


Thanks in advance.
 
I also tried the same code with the apache commons net ftp class, this gave the error

Code:
java.netSocketException : Permission Denied
 
Back
Top Bottom