Thread View: borland.public.cppbuilder.internet.socket
5 messages
5 total messages
Started by Blake Young
Fri, 22 Jul 2005 06:33
SLOW ftp upload
Author: Blake Young
Date: Fri, 22 Jul 2005 06:33
Date: Fri, 22 Jul 2005 06:33
37 lines
2593 bytes
2593 bytes
I have been sitting here watching my upload progress and in the past 5
minutes only 15 KB of a certain file have been uploaded. The weird thing is
that sometimes the transfer is blazingly fast, and other times it goes at
literally about 2 or 3 KBs a second. I am uploading the files-in-question
to my Tripod account via my own mini-FTP program. FTPClient is a TIdFTP
component. Below is my code:
FTPClient->Host = "ftp.tripod.com";
FTPClient->Port = 21;
FTPClient->User = "winboxer";
FTPClient->Password = "CENSORED";
FTPClient->Connect();
Memo1->Lines->Add("Uploading version information...");
FTPClient->TransferType = ftASCII;
FTPClient->Put("version.txt", "version.txt", false);
Memo1->Lines->Add("Uploading WinBoxer program...");
FTPClient->TransferType = ftBinary;
FTPClient->Put("winboxer.zip", "winboxer.zip", false);
Memo1->Lines->Add("Uploading WinBoxer source code...");
FTPClient->Put("winboxer_source.zip", "winboxer_source.zip", false);
Memo1->Lines->Add("Publishing complete. Disconnecting...");
FTPClient->Disconnect();
Like I said before, sometimes the speed is very fast but most of the time it
goes at a snail's pace. One thing that I've noticed is that it does NOT
alternate between the two speeds: if it starts slow, it will remain slow the
whole time...if it starts fast, it will remain fast the whole time. I'm on
DSL, so I know it's not my connection speed. Also, I can log into my Tripod
account via FTP using Internet Explorer and upload files and they go
super-fast - even at the SAME time that they're uploading slow using my
program. Is there something about my code that may make it (on occasion)
procede very slowly?
Re: SLOW ftp upload
Author: Blake Young
Date: Fri, 22 Jul 2005 23:08
Date: Fri, 22 Jul 2005 23:08
3 lines
1155 bytes
1155 bytes
Well, I rewrote all my code using straight Win32 API functions (InternetOpen, InternetConnect, and FtpPutFile) and it's still going slow. Internet Explorer must use some other protocol to make it go so fast.
Re: SLOW ftp upload
Author: Remy Lebeau (TeamB)
Date: Fri, 22 Jul 2005 23:32
Date: Fri, 22 Jul 2005 23:32
16 lines
1540 bytes
1540 bytes
"Blake Young" <blakeyoung@mail.utexas.edu> wrote in message news:42e17c71$1@newsgroups.borland.com... > Well, I rewrote all my code using straight Win32 API functions > (InternetOpen, InternetConnect, and FtpPutFile) and it's still > going slow. Internet Explorer must use some other protocol to > make it go so fast. Without seeing your actual code, I would suspect that your own code is the bottleneck, especially since you get the same slowness using two different libraries. Or maybe your connection is just slow in general, or your machine is busy doing other things at the time, etc. Gambit
Re: SLOW ftp upload
Author: Blake Young
Date: Sat, 23 Jul 2005 18:01
Date: Sat, 23 Jul 2005 18:01
75 lines
3787 bytes
3787 bytes
Here is a complete program example showing my problem. I've noticed that as
soon as the Put() command is executed, my program appears to stop
responding. In other words, I can't move the window around, the button on
the form disappears, and if I move another window over my program, my
program window will not be redrawn after the other window is moved out of
the way. In addition, the upload is again going at a nearly imperceptable
pace. I thought that moving the upload code to its own thread might help,
but it did not. I looked at the CPU usage and it remained at 0% for my
program, even though the CPU usage for ALL open programs was only at about
3% (i.e. my system isn't bogged). Furthermore, I can log into the FTP
account via Internet Explorer and upload files at a fast pace, so the
program appears to be somewhere inside my code. Again, this is MY ENTIRE
PROGRAM! This is not a snippet from a larger piece of code. It's seems
very small and trivial, so I don't know what in the world could be the
problem. Compiling it only involves adding a button, a memo, an open
dialog, and a TIdFTP component to a default New Application.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (!OpenDialog1->Execute())
return;
AnsiString LocalFileName = OpenDialog1->FileName;
AnsiString RemoteFileName = ExtractFileName(OpenDialog1->FileName);
Memo1->Lines->Add("Connecting to ftp.tripod.com...");
if (IdFTP1->Connected())
IdFTP1->Disconnect();
IdFTP1->Host = "ftp.tripod.com";
IdFTP1->Port = 21;
IdFTP1->User = "winboxer";
IdFTP1->Password = "CENSORED";
IdFTP1->Connect();
Memo1->Lines->Add("Uploading selected file...");
try
{
IdFTP1->Put(LocalFileName, RemoteFileName, false);
}
catch (Exception &e)
{
Application->ShowException(&e);
IdFTP1->Disconnect();
return;
}
Memo1->Lines->Add("File uploaded. Disconnecting...");
IdFTP1->Disconnect();
}
//---------------------------------------------------------------------------
Thanks
Blake
Re: SLOW ftp upload
Author: Remy Lebeau (TeamB)
Date: Sat, 23 Jul 2005 20:15
Date: Sat, 23 Jul 2005 20:15
16 lines
1628 bytes
1628 bytes
"Blake Young" <blakeyoung@mail.utexas.edu> wrote in message news:42e285f7$1@newsgroups.borland.com... > Here is a complete program example showing my problem. I've > noticed that as soon as the Put() command is executed, my program > appears to stop responding. Indy is a blocking library. Its operations do not return control to the caller until the operations finish. You are calling Put() in the context of the main VCL thread. That is why everything is frozen while Put() does its work. You need to either place a TIdAntiFreeze on the form, or else move the TIdFTP to its own worker thread. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads