NetTalk Central

Author Topic: Fetch in a loop  (Read 18926 times)

oeb

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Email
Fetch in a loop
« on: November 28, 2007, 02:39:39 AM »
I'm trying to run ThisWebClient.Fetch in a loop in order to fill data in a queue. However, pagereceived is not called until the end of the loop (both in synchronous and asynchronous mode), so I only get data in the last entry of the queue. Is it in any way possible to use Fetch in a loop or do I have to think of another solution? Ideally, I'd wanted to run ThisWebClient.Fetch --> Call pagereceived (or error) --> Return to the loop where it left and continue processing the rest of the data. It would really be more practical to have it call the same produre each time so I knew where it would end up no matter if there was an error or not (i.e. a "fetchresult"). Obviously there will be some time delay, but this is not a time-critical application.
--------------------
Ole

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Fetch in a loop
« Reply #1 on: November 28, 2007, 03:02:31 AM »
Hi Oeb,

The procedure is always asynchronous. (The "open" can be synchronous, but it's recommended that that too is asynchronous).

So you can't call "fetch" in a loop.
Rather call fetch
then in ErrorTrap, and PageReceived, call Fetch for the next item.

Cheers
Bruce