🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #355

indy question

#355
From: bar
Date: Sat, 22 Mar 2008 17:55
81 lines
3172 bytes
I am using indy 9 with BCB6.0

I want to download some xml files in stream format.

TldHTTP component dropped on the main form with properties
HandleRedirects = true;
Connection = Keep-Alive;
CacheControl = no-cache;
ConnectTimeout = 0;

//Header file
TMemoryStream *XMLStream;
String ErrorStream;

TDateTime ReceivedTime,TakeTime;
long int 
TotalPackets,OneTimeReceivedPackets,PreviousPackets,Duration,TrasferRate;


//Cpp file.
void TfrmMain::DownloadStream(String URL)
{
    try
    {
        ErrorStream = "";
        HTTP->Get(URL, XMLStream);
    }
    catch(const Exception &E)
    {
         if(HTTP->Connected())
                 HTTP->Disconnect();

         ErrStream = E.Message;
    }
}

//I am displaying a progress bar
void __fastcall TfrmMain::HTTPConnected(TObject *Sender)
{
    Application->ProcessMessages();
    this->Update();
    lblDownloadStatus->Caption = "Connected.";
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::HTTPWorkBegin(TObject *Sender,
      TWorkMode AWorkMode, const int AWorkCountMax)
{
    Application->ProcessMessages();
    this->Update();

    ProgressBar1->Position = 0;
    ProgressBar1->Max = AWorkCountMax;
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::HTTPWork(TObject *Sender, TWorkMode AWorkMode,
      const int AWorkCount)
{
    Application->ProcessMessages();
    this->Update();

    ProgressBar1->Position = AWorkCount;
    ProgressBar1->Update();
//---------------------------------------------------------------------------

As i TldHTTP dropped in GUI form. It is blocking the GUI messages but i 
don't have any problem when the internet speed and server is response is 
good.

I have the following problem.
1.When the server is busy it is waiting for something 10-15 seconds and then 
raising the exception.
2.And some times the form is freezing and form is not responding.

Questions
1. Have anybody experienced this problem. Why the same code is not 
responding at some occasions.
2. Even if responding its taking time, can we make it active, reduce the 
checking time.
3  Setting ConnectTimeout can make any difference, does it work in this 
case. 
Technical Details
Message-ID: <47e547f8@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!news.isoc.lu!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2ee1e8f11ef880ab,start
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "bar" <shaikakbar250281@yahoo.co.in>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: indy question
Date: Sat, 22 Mar 2008 20:55:04 +0300
Lines: 83
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 62.150.204.196
Message-ID: <47e547f8@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1206208504 62.150.204.196 (22 Mar 2008 10:55:04 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!news.isoc.lu!newsgroups.borland.com!not-for-mail