🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages Started by Colin B Maharaj Thu, 26 May 2005 11:21
EldReadTimeOut Process Stopped
#3919
Author: Colin B Maharaj
Date: Thu, 26 May 2005 11:21
44 lines
2110 bytes
Hi folks, I have a TCP Client Connected to a TCP Server (Indy 9.0.18) 
and now I want to place reading of the Client Data in a Thread. except I 
get a EldReadTimeOut error and the process is then stopped. My code is 
taking all the client data and placing it in a Memo.

Net1 is a data module with a TcpClient I call Client1....
Any help will be appreeciated.


//---------------------------------------------------------------------------
AnsiString Data;
TTcpClientReader * TcpReader1;

__fastcall TTcpClientReader::TTcpClientReader(bool CreateSuspended)
         : TThread(CreateSuspended)
{

}
//---------------------------------------------------------------------------

void __fastcall TTcpClientReader::Execute()
{
   while (Net1->Client1->Connected() == true)
   {
     AnsiString A = Net1->Client1->CurrentReadBuffer();
     if (A.Length() > 0)
     {
       Data = Net1->Client1->ReadLn();
       Synchronize(UpdateCaption);
     }
     else
     {
       Sleep(25);
     }
   }

}

//---------------------------------------------------------------------------

  void __fastcall TTcpClientReader::UpdateCaption()
  {
    Form1->Memo1->Lines->Add(Data);
  }
Re: EldReadTimeOut Process Stopped
#3920
Author: Colin B Maharaj
Date: Thu, 26 May 2005 12:18
2 lines
1047 bytes
I know, I know set the Timeout to zero.....
Thanks...
Re: EldReadTimeOut Process Stopped
#3921
Author: Remy Lebeau (TeamB)
Date: Thu, 26 May 2005 16:44
27 lines
1681 bytes
"Colin B Maharaj" <noreply@myhost.com> wrote in message
news:4295b153@newsgroups.borland.com...

>      AnsiString A = Net1->Client1->CurrentReadBuffer();
>      if (A.Length() > 0)
>      {
>        Data = Net1->Client1->ReadLn();

Why are you reading all of the incoming data, discarding it, and then
reading a new line?  Shouldn't you be displaying the data you already
received?

    void __fastcall TTcpClientReader::Execute()
    {
        while( Net1->Client1->Connected() )
        {
            Data = Net1->Client1->CurrentReadBuffer();
            if( Data.Length() > 0 )
                Synchronize(UpdateCaption);
        }
        else
            Sleep(25);
    }


Gambit
Re: EldReadTimeOut Process Stopped
#3922
Author: Colin B Maharaj
Date: Sun, 29 May 2005 00:30
33 lines
1962 bytes
Thanks again for helping me identify my in-efficiencies. Yes really!

Remy Lebeau (TeamB) wrote:
> "Colin B Maharaj" <noreply@myhost.com> wrote in message
> news:4295b153@newsgroups.borland.com...
> 
> 
>>     AnsiString A = Net1->Client1->CurrentReadBuffer();
>>     if (A.Length() > 0)
>>     {
>>       Data = Net1->Client1->ReadLn();
> 
> 
> Why are you reading all of the incoming data, discarding it, and then
> reading a new line?  Shouldn't you be displaying the data you already
> received?
> 
>     void __fastcall TTcpClientReader::Execute()
>     {
>         while( Net1->Client1->Connected() )
>         {
>             Data = Net1->Client1->CurrentReadBuffer();
>             if( Data.Length() > 0 )
>                 Synchronize(UpdateCaption);
>         }
>         else
>             Sleep(25);
>     }
> 
> 
> 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