I am trying to connect to an FTP server in an Android application and I believe that I fall in an infinite loop, but can't understand why. The library I am using is Apache Comomns net.
I have the internet permission in manifest :
<uses-permission android:name="android.permission.INTERNET"/>
I am also connecting to the FTP in an AsyncTask.
Here is a sample code which was supposed to work :
// I have other values when I test it of course
FTPClient ftpClient = new FTPClient();
ftpClient.connect("111.111.111.111"); // It stops working here when in 4G
ftpClient.login("user", "mdp");
ftpClient.changeWorkingDirectory("directory");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
ftpClient.enterLocalPassiveMode();
ftpClient.logout();
ftpClient.disconnect();
It works on Wifi (and my real application works too in wifi) but when I use my 4G (or 3G) it seems to loop at the line where I try to connect() forever.
I have tryed to understand what there is behind this but it's not clear for me.
How can I connect to my FTP using 4G?
Any help would be appreciated.