i am trying to connect to a server through a apache FTP:
public boolean ftpConnect(String host, String user, String pass){
try {
ftpClient = new FTPClient();
ftpClient.connect(host);
if(FTPReply.isPositiveCompletion(ftpClient.getReplyCode())){
boolean status = ftpClient.login(user, pass);
ftpClient.enterLocalPassiveMode();
return status;
}
} catch (SocketException e) {
Log.d("FTP", "Error: could not connect to socket " + host );
} catch (IOException e) {
Log.d("FTP", "Error: could not connect to host " + host );
}
return false;
}
If i am connected to internet through WI-FI, the above code is working, but if i am connected through 3G is not working. I’ve already added the permission for Internet on the
manifest. I haven’t found an explanation for this on google.
Also, see my answer here: Track FTP upload data in android?.