Re: Problem with Telnet clients

Giganews Newsgroups
Subject: Re: Problem with Telnet clients
Posted by:  Remy Lebeau (TeamB) (
Date: Thu, 10 Feb 2005

"A. Stern" <ahCUT…> wrote in message

> I'm using BCB 6.0 Enterprise Suite with Indy 8.0.25 on Windows 2000.

That is a very old version of Indy.  You should seriously consider

>    AnsiString IP;
>    IP = CuLAMainForm->UnsoModList->Strings[ModemIdx*5];
>    IP.Delete(1,3);

That code is not thread-safe.  You should be using TThread::Synchronize() to
access the main thread objects in a thread-safe manner.

>    ATelnetClient->OnDataAvailable = &ATelnetClientOnDataAvailable;

By default, the OnDataAvailable event is triggered via a call to

>    while(ATelnetClient->Connected()){};

That loop is too tight.  It does not yield CPU cycles to other threads.
That could be causing some of your problems, especially if Synchronize() is
not able to execute the OnDataAvailable code in a timely fashion.  You
should put a call to Sleep() in the loop:

    while( ATelnetClient->Connected() )



In response to

Problem with Telnet clients posted by A. Stern on Thu, 10 Feb 2005