Board index » delphi » TIdTCPClient OnData event

TIdTCPClient OnData event

Hello,

I use Indy IdTCPClient component to communicate via TCP. Is it possible to
have event like OnDataReady or something close to this. It is not very nice
to do in following way:

while s='' do

    begin

    s:=IdTCPClient1.ReadLn;

    end;

Thank you in advance

 

Re:TIdTCPClient OnData event


<col...@centras.lt> wrote in news:3eae3898$1@newsgroups.borland.com:

Quote
> I use Indy IdTCPClient component to communicate via TCP. Is it possible to
> have event like OnDataReady or something close to this. It is not very nice
> to do in following way:

Read "Intro to Indy". You will not be successful with Indy until you
understand how Indy works.

http://www.atozedsoftware.com/indy/articles.html

--

ELKNews FREE Edition - Empower your News Reader! http://www.atozedsoftware.com

Re:TIdTCPClient OnData event


Hello,

Thank you for link. Ok, no events, separate thread. But code bellow takes
100% CPU anyway.

while s='' do
    begin
    s:=IdTCPClient1.ReadLn;

    end;

"Chad Z. Hower aka Kudzu" <c...@hower.org> wrote in message
news:Xns936C8AB1ED395cpub@127.0.0.1...

Quote
> <col...@centras.lt> wrote in news:3eae3898$1@newsgroups.borland.com:
> > I use Indy IdTCPClient component to communicate via TCP. Is it possible
to
> > have event like OnDataReady or something close to this. It is not very
nice
> > to do in following way:

> Read "Intro to Indy". You will not be successful with Indy until you
> understand how Indy works.

> http://www.atozedsoftware.com/indy/articles.html

> --

> ELKNews FREE Edition - Empower your News Reader!

http://www.atozedsoftware.com

Re:TIdTCPClient OnData event


Quote
> Thank you for link. Ok, no events, separate thread. But code bellow
takes
> 100% CPU anyway.

> while s='' do
>     begin
>     s:=IdTCPClient1.ReadLn;

>     end;

Not in my apps.  The readLn blocks until a terminator comes in.

Rgds,
Martin

Other Threads