Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.5k views
in Java FTP by (240 points)
Hello... I am able to upload small files with no problem; however, when uploading a large file (500-800 KB) I get an error message like the following

File Transfer Error: Unable to read data from the transport connection. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connection host has failed to respond.


This has always worked with other code, just not edtFTP. What settings do I have to change to get this to work with large files?

6 Answers

0 votes
by (162k points)
It should work fine. A 800K file is a small file. Your server could be timing out the connection - post the log file.
0 votes
by (240 points)
It might be easier if I just upload my code... (let me know if you still want the log; I don't think it will show anything other than the error message I copied verbatim). The code is written as a method now; might change it later to a class...

------------------------- code starts here ------------------------
//--------------------- code to upload a file -----------------------
public int uploadFile(string[] args)
{

Logger log = Logger.GetLogger(typeof(mainForm));

// assign args to make it clear
string userID = args[0];
string password = args[1];
string hostURL = args[2];
string fileName = args[3];
string directory = args[4];

Logger.CurrentLevel = Level.ALL;

FTPClient ftp = new FTPClient();
ftp.RemoteHost = hostURL;

try
{
// connect
log.Info("Connecting");
ftp.Connect();
if (ftp.IsConnected == true)
{
// login
log.Info("Logging in");
ftp.Login(user, password);

// set up passive ASCII transfers
log.Debug("Setting up passive, ASCII transfers and TransferBufferSize");
ftp.ConnectMode = FTPConnectMode.PASV;
ftp.TransferType = FTPTransferType.ASCII;
ftp.TransferBufferSize = 2048;

// change directory if necessary
log.Info("changing directory");
if (directory != null && directory.Length > 0)
ftp.ChDir(directory);

// copy file to server
string[] shortFilename = fileName.Split('\\');
lbUploadStatus.Items.Insert(0, "starting transfer of " + shortFilename[3]);
lbUploadStatus.Refresh();

log.Info("Putting file: " + fileName + " shortFilename: " + shortFilename[3]);
ftp.Put(fileName, shortFilename[3]); // local path, remote filename

// Shut down client
log.Info("Quit issued...");
ftp.Quit();
}
}
catch (Exception e)
{
log.Debug(e.Message, e);
MessageBox.Show("File transfer error: " + e.Message, "Prager, Software", MessageBoxButtons.OK, MessageBoxIcon.Error);
return -1;
}
return 0;
}
----------------------------------- code ends here --------------------------------
0 votes
by (162k points)
The relevant part of the log will be a help
0 votes
by (240 points)
Would there be anything in the log other than what I already sent you? (I copied the error message verbatim). The reason I ask is that other than what logging statements I have, I don't see what it's going to give you. No problem, I'll do it, but just wondering.

Rolf
0 votes
by (240 points)
Well, I changed the config file and ran the program... everything worked this time, but I didn't get a log file. What name should I be looking for?
0 votes
by (162k points)
You must explicitly enable logging to a file - search on this forum or take a look at the documentation, particularly the com.enterprisedt.util.debug package.

Categories

...