Re: receiving endless streams

Giganews Newsgroups
Subject: Re: receiving endless streams
Posted by:  Remy Lebeau \(Indy Team\) (re…@lebeausoftware.org)
Date: Mon, 10 May 2010

"Chris Ueberall" <CUebera…@web.de> wrote in message
news:7A0424677BAEE340CUebera…@web.de...

> I need to receive an endless stream which I request via GET.
> Is that possible with Indy and what would be the best way to achieve it?

You will have to call TIdHTTP.Get() in a worker thread so that the rest of
your code is not blocked.

> When I use TidHTTP.Get, then this command will never return, no
> surprise so far.

Right, because it is waiting for an end to the response, which never
arrives.

> I tried several approaches to get the received data in the OnWorkEnd
> event, but unfortunately that wasn't successful.

The actual data is not accessible in the OnWork events.  The only way to
access the data in this situation is to derive your own class from TStream
and override its Write() method.  You can then pass an instance of that
class to Get() as the destination.  Whenever TIdHTTP writes data into it,
you can have your Write() implementation move the data to wherever you need
it.

--
Remy Lebeau (TeamB)

Replies

In response to

receiving endless streams posted by Chris Ueberall on Sun, 9 May 2010