Article View: borland.public.cppbuilder.internet.socket
Article #3707Re: SLOW ftp upload
From: 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
Technical Details
Message-ID:
<42e285f7$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.inode.at!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42e09342@newsgroups.borland.com> <42e17c71$1@newsgroups.borland.com> <42e18444$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,752f9577c22b21e3 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Blake Young" <blakeyoung@mail.utexas.edu> Newsgroups: borland.public.cppbuilder.internet.socket References: <42e09342@newsgroups.borland.com> <42e17c71$1@newsgroups.borland.com> <42e18444$1@newsgroups.borland.com> Subject: Re: SLOW ftp upload Date: Sat, 23 Jul 2005 13:01:19 -0500 Lines: 77 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 68.91.216.87 Message-ID: <42e285f7$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1122141687 68.91.216.87 (23 Jul 2005 11:01:27 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed.inode.at!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail