Hi ,
i am glad to have such a kind of library for ftp client. I am currently making an android application.
But on the first step i faced a little problem.
The problem is of host not resolved. i want to access the ftp . should i have to provide any other link than www.mysite.com ?
(i) java.net.UnknownHostException: Unable to resolve host "
http://www.myweb.com/": No address associated with hostname
here is my main activity android apps code..
public class MainActivity extends Activity implements OnClickListener{
FileTransferClient ftp = null;
Button cOnnect;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ftp = new FileTransferClient();
cOnnect = (Button) findViewById(R.id.button1);
cOnnect.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.button1:
new myAsynTask().execute();
break;
}
}
public class myAsynTask extends AsyncTask<String, String, String>{
ProgressDialog pDialog;
@Override
protected void onPreExecute() {
pDialog = new ProgressDialog(MainActivity.this);
pDialog.setMessage("Loading products. Please wait...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected String doInBackground(String... params) {
try {
ftp.setRemoteHost("
http://www.myweb.com/");
ftp.setUserName("myUserName");
ftp.setPassword("myPass");
ftp.getAdvancedSettings().setAutoLogin(false);
ftp.connect();
ftp.manualLogin();
} catch (FTPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
pDialog.dismiss();
}
}
===========
Here is stack log cat.
09-19 18:01:28.118: W/System.err(782): java.net.UnknownHostException: Unable to resolve host "
http://www.myweb.com/": No address associated with hostname
09-19 18:01:28.296: W/System.err(782): at java.net.InetAddress.lookupHostByName(InetAddress.java:424)
09-19 18:01:28.316: W/System.err(782): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
09-19 18:01:28.316: W/System.err(782): at java.net.InetAddress.getByName(InetAddress.java:289)
09-19 18:01:28.316: W/System.err(782): at com.enterprisedt.net.ftp.FTPClient.connect(FTPClient.java:999)
09-19 18:01:28.316: W/System.err(782): at com.enterprisedt.net.ftp.FileTransferClient.connect(FileTransferClient.java:392)
09-19 18:01:28.316: W/System.err(782): at com.example.secondftp.MainActivity$myAsynTask.doInBackground(MainActivity.java:72)
09-19 18:01:28.316: W/System.err(782): at com.example.secondftp.MainActivity$myAsynTask.doInBackground(MainActivity.java:1)
09-19 18:01:28.316: W/System.err(782): at android.os.AsyncTask$2.call(AsyncTask.java:287)
09-19 18:01:28.326: W/System.err(782): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-19 18:01:28.356: W/System.err(782): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-19 18:01:28.416: W/System.err(782): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
09-19 18:01:28.416: W/System.err(782): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-19 18:01:28.416: W/System.err(782): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-19 18:01:28.486: W/System.err(782): at java.lang.Thread.run(Thread.java:856)
09-19 18:01:28.506: W/System.err(782): Caused by: libcore.io.GaiException: getaddrinfo failed: EAI_NODATA (No address associated with hostname)
09-19 18:01:28.517: W/System.err(782): at libcore.io.Posix.getaddrinfo(Native Method)
09-19 18:01:28.536: W/System.err(782): at libcore.io.ForwardingOs.getaddrinfo(ForwardingOs.java:55)
09-19 18:01:28.606: W/System.err(782): at java.net.InetAddress.lookupHostByName(InetAddress.java:405)
09-19 18:01:28.646: W/System.err(782): ... 13 more
==============
Kindly help me in solving the problem... or either provide me any complete application with complete code for ftp client. I shall be thank full to you.
take care. waiting for your reply.
Thanks.