Good morning,
I'm trying to upload a file to a server via FTP:
try{
FTPClient ftp = new FTPClient();
ftp.connect(server);
if(!ftp.login(username, password)){
ftp.logout();
}
ftp.enterLocalPassiveMode();
int reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)){
ftp.disconnect();
}
InputStream in = new FileInputStream(ruta);
ftp.setFileType(ftp.BINARY_FILE_TYPE, ftp.BINARY_FILE_TYPE);
ftp.setFileTransferMode(ftp.BINARY_FILE_TYPE);
ftp.storeFile("cartel"+t+".txt", in);
in.close();
ftp.logout();
ftp.disconnect();
}
catch (Exception ex){
ex.printStackTrace();
}
Everything works correctly (it establishes connection, it does the login correctly and the file is uploaded) but the program remains stopped at the moment that storeFile does. He stays as if he never finished the instruction and does not follow the program. I've seen in several forums and several pages that everyone does the same.
Any ideas of what may be happening?
Thanks in advance.