Link to home
Start Free TrialLog in
Avatar of Roger Alcindor
Roger Alcindor

asked on

IdTelnet1DataAvailable handler freezes the Application

The event handler (shown below) saves a telnet hosts received data in a list of AnsiStrings ( named mess ) and after a period of silence , a time is activated which will process the list.
unfortunately, the timer never fires and the system freezes ( not able to move the form or click any Buttons on the form.
Can anyone see why ? I am using Indy 9 on Borland C++ Builder 5; very old but it's an old application that's being modified.


void __fastcall TForm1::IdTelnet1DataAvailable(TIdTelnet *Sender,
      const AnsiString Buffer)
{

    mess.push_back(Buffer);
    Timer1->Enabled = false;
    Timer1->Enabled = true;
}
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Does your app enter into DataAvailable event? Why not process your list in DataAvailable event immediately? Do you set Timer1 OnTimer event properly?
Avatar of Roger Alcindor
Roger Alcindor

ASKER

The app does enter the DataAvailable event. The timer1 OnTimer event is set ok. I don't process the event immediately because that didn't work; I got the same result whereby the app hangs. I was just adding the received data to a TMemo control to display it.
I decided to use a list to determine if the problem was related to adding the received sting to the TMemo control but this made no difference. I can set a breakpoint in the DataAvailable event handler and inspect the data received and when the code execution  is resumed the app hangs.
ASKER CERTIFIED SOLUTION
Avatar of Roger Alcindor
Roger Alcindor

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I discovered the solution myself.