Read Time Out when using FTPClient in Java. Right at the end of the transfer


I hope you can help me.

I am trying to save a file on an FTP server that I have in WIndows Server 2012 with the following code, in fact I worked without problems when I had the FTP server in Linux.

FTPClient ftpClient = new FTPClient();
ftpClient.connect(InetAddress.getByName(argsFtp[ftpHost]), 21);
ftpClient.login(argsFtp[ftpUsuario], argsFtp[ftpClave]);

//Verificar conexión con el servidor.
String[] replies = ftpClient.getReplyStrings();
if (replies != null && replies.length > 0) {
    for (String aReply : replies) {
        System.out.println("SERVER: " + aReply);

int reply = ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
    System.out.println("Imposible conectarse al servidor FTP");

//Verificar si se cambia de direcotirio de trabajo
ftpClient.changeWorkingDirectory(argsFtp[rutaBackupFtp]);//Cambiar directorio de trabajo
//System.out.println("Se cambió satisfactoriamente el directorio: " + ftpClient.printWorkingDirectory());

//Activar que se envie cualquier tipo de archivo
//ftpClient.setControlKeepAliveTimeout(180); // set timeout to 3 minutes
// data transfer timeout
FileInputStream buffIn = new FileInputStream(argsFtp[rutaBackupLocal]);//Ruta del archivo para enviar
ftpClient.storeFile(argsFtp[nombreBackUp], buffIn);//Ruta completa de alojamiento en el FTP

buffIn.close(); //Cerrar envio de archivos al FTP
ftpClient.logout(); //Cerrar sesión
ftpClient.disconnect();//Desconectarse del servidor
System.out.println("Enviado Backup al servidor por FTP...OK");

During the process I check on the server and the file is loading, when it is finished, it shows me the following error and the file is deleted. Read timed out at (Native Method) at ( at ( at ( at   sun.nio.cs.StreamDecoder.readBytes ( at   sun.nio.cs.StreamDecoder.implRead ( at ( at ( at ( at ( at (   at .__ getReply ( at .__ getReply ( at ( at (   at (   at .__ storeFile (   at (   at eidybackup.EidyBackup.enviarBackupFTP ( at   eidybackup.EidyBackup.main (

Thank you.

asked by Xanders 20.12.2018 в 19:30

0 answers