Board index » delphi » Indy 8, TIdTCPClient, OnData ??

Indy 8, TIdTCPClient, OnData ??

Hi,

do i have to use an timer to check if there is any data arrived ??

Is'nt there a event fired when data arrives ??

If not, which is the best way to handle "onData" ??

I'm using WriteLn and ReadLn .. As soon as i get a good routine for
sending/Receiving data the "streamed" way, i'll change, cause when i use the
WriteLn and ReadLn i got to transfer my data as Base64 encoded text..

And i want a "small" protocoll.

Any help would do!! =)

Regards, Peter

 

Re:Indy 8, TIdTCPClient, OnData ??


i can mail you a extract, how i send fax files, a mix with strings for
commands and the
files with streaming.

regards Ernst

"Peter Falkesand" <pe...@datavara.se> schrieb im Newsbeitrag
news:3c062c27$1_1@dnews...

Quote
> Hi,

> do i have to use an timer to check if there is any data arrived ??

> Is'nt there a event fired when data arrives ??

> If not, which is the best way to handle "onData" ??

> I'm using WriteLn and ReadLn .. As soon as i get a good routine for
> sending/Receiving data the "streamed" way, i'll change, cause when i use
the
> WriteLn and ReadLn i got to transfer my data as Base64 encoded text..

> And i want a "small" protocoll.

> Any help would do!! =)

> Regards, Peter

Re:Indy 8, TIdTCPClient, OnData ??


yes, please do that.

Regards, Peter

Re:Indy 8, TIdTCPClient, OnData ??


Peter Falkesand schrieb:

Quote
> do i have to use an timer to check if there is any data arrived ??

A timer or an extra thread or a TIdAntiFreeze component. The latter one
has its limit: It can't handle two client connections at the same time.
So an extra thread would be the best solution, IMHO.

Quote
> Is'nt there a event fired when data arrives ??

No, Indy's (sp?) TCP client component reads synchronous (sp?), blocking
everything else in the same thread.

Quote
> If not, which is the best way to handle "onData" ??

I just uploaded a possibly useful component to
http://come.to/delphi-bits . It extends TIdTCPClient by a worker thread
and it fires an OnData event.

Quote
> I'm using WriteLn and ReadLn .. As soon as i get a good routine for
> sending/Receiving data the "streamed" way, i'll change, cause when i use the
> WriteLn and ReadLn i got to transfer my data as Base64 encoded text..

No, you don't need to limit WriteLn to 7 bit. Indy can write and read
binary data as AnsiStrings as like as Delphi handles AnsiStrings without
giving a single character a special meaning. OTOH, if you have a stream
ready to send, look at WriteStream.

-Michael

Re:Indy 8, TIdTCPClient, OnData ??


Thanks, for the answers.. I'll dig into it at once..

Regards, Peter

Other Threads