Alaska Software Inc. - Non-Blocking LoadFromUrl
Username: Password:
AuthorTopic: Non-Blocking LoadFromUrl
Jose Adriano Baltieri Non-Blocking LoadFromUrl
on Mon, 19 Jul 2004 08:01:04 -0300
Hello !

I've posted this before but, here it goes again :

I need a smaller timeout for LoadFromUrl. It seems to me that it is defaulting 
to the machine's browser timeout, which is generally 5 minutes.

Too much for me. So, I'd need either :

1) To specify this timeout, somehow or
2) To have a non-blocking LoadFromUrl, possibly specifying a code block to be 
evaluated WHILE it does its job.

Have you ever faced this situation ?

thanXs for your suPPort !
Jose Adriano Baltieri Re: Non-Blocking LoadFromUrl
on Tue, 20 Jul 2004 08:20:41 -0300
Meanwhile, I've tought about a solution for this problem. Not the one I wished 
but, at least is solves partially the issues I've bubled.

The idea is to encapsulate LoadFromUrl inside a thread. Outside the thread I'd 
  have control over it and could keep on doing what I need to do and, quit the 
thread if necessary.

I dont think is a stetic solution but, at least, I can solve my impass.

Hope the idea may help someone else..

thanXs for your suPPort, anyway !

Jose Adriano Baltieri wrote:
> Hello !
> 
> I've posted this before but, here it goes again :
> 
> I need a smaller timeout for LoadFromUrl. It seems to me that it is 
> defaulting to the machine's browser timeout, which is generally 5 minutes.
> 
> Too much for me. So, I'd need either :
> 
> 1) To specify this timeout, somehow or
> 2) To have a non-blocking LoadFromUrl, possibly specifying a code block 
> to be evaluated WHILE it does its job.
> 
> Have you ever faced this situation ?
> 
> thanXs for your suPPort !
>
Anand GuptaRe: Non-Blocking LoadFromUrl
on Wed, 21 Jul 2004 10:44:15 +0530
But I guess, you want to show a progress-bar kindda thing whilst,
LoadFromUrl() is fetching the page, rite ?
Usage of a thread, wont let you achieve this, I guess (or did I got your
query wrong ?)

Anand

"Jose Adriano Baltieri" <jabaltie@unimep.br> wrote in message
news:MF$IttkbEHA.7524@S15147418...
> Meanwhile, I've tought about a solution for this problem. Not the one I
wished
> but, at least is solves partially the issues I've bubled.
>
> The idea is to encapsulate LoadFromUrl inside a thread. Outside the thread
I'd
>   have control over it and could keep on doing what I need to do and, quit
the
> thread if necessary.
>
> I dont think is a stetic solution but, at least, I can solve my impass.
>
> Hope the idea may help someone else..
>
> thanXs for your suPPort, anyway !
>
> Jose Adriano Baltieri wrote:
> > Hello !
<snip>
Jose Adriano Baltieri Re: Non-Blocking LoadFromUrl
on Wed, 21 Jul 2004 07:55:00 -0300
Anand Gupta wrote:
> But I guess, you want to show a progress-bar kindda thing whilst,
> LoadFromUrl() is fetching the page, rite ?
> Usage of a thread, wont let you achieve this, I guess (or did I got your
> query wrong ?)

As a matter of fact, the application is a console mode one. But, yes, the page 
is being fetched OK, although it delays a lot sometimes (server problem).

Of course, a thread wont let me build a gauge but, at least I can control the 
timeout, which is what I need right now.

Just think these enhancementes would be welcome in LoadFromUrl.

My suggestion (is Alaska hearing?) is to have not only a UDF but one that can 
control its behaviour.

For instance, this might be an implementation of a UDF (considering the idea I 
have of function protocol for that) :

FUNCTION UDF4LOADFROMURL(LNSTEP)

STATIC SNSTART

IF       LNSTEP == OPENING_SOCKET   TO THE DESTINATION SERVER, EITHER 80/443
          SNSTART:=SECONDS()
          @ 0,24 SAY "OPENING SOCKET..."
ELSEIF   LNSTEP == ISSUING_REQUEST  GET OR POST
	 @ 0,24 SAY "ISSUING REQUEST..."
ELSEIF   LNSTEP == WAITING_RESULT
          IF  SECONDS() - SNSTART >= MYTIMEOUT
              @ 0,24 SAY "QUITING LOADFROMURL"
              RETURN QUIT_LOADFROMURL
          END IF
ELSEIF	 LNSTEP == CLOSING_SOCKET
          @ 0,24 SAY "CLOSING SOCKET"
END IF

RETURN GO_ON_LOADFROMURL

As for the Gauge, so far, I'm a "console mode only" guy 

thanXs for your suPPort !
		

> Anand
> 
> "Jose Adriano Baltieri" <jabaltie@unimep.br> wrote in message
> news:MF$IttkbEHA.7524@S15147418...
> 
>>Meanwhile, I've tought about a solution for this problem. Not the one I
> 
> wished
> 
>>but, at least is solves partially the issues I've bubled.
>>
>>The idea is to encapsulate LoadFromUrl inside a thread. Outside the thread
> 
> I'd
> 
>>  have control over it and could keep on doing what I need to do and, quit
> 
> the
> 
>>thread if necessary.
>>
>>I dont think is a stetic solution but, at least, I can solve my impass.
>>
>>Hope the idea may help someone else..
>>
>>thanXs for your suPPort, anyway !
>>
>>Jose Adriano Baltieri wrote:
>>
>>>Hello !
> 
> <snip>
> 
>
Jose Adriano Baltieri Re: Non-Blocking LoadFromUrl
on Fri, 23 Jul 2004 14:51:06 -0300
Well, since I've got not a better answer, I'm suggesting here a little program 
that wraps loadfromurl on a thread.

It may be useful 4 other people with the same problem:

# INCLUDE "BASICO.CH"
# INCLUDE "ASINET.CH"

PROC MAIN

LOCAL LOTHREAD:=THREAD():NEW()

LOTHREAD:START("MYLOADFROMURL")

WHILE LOTHREAD:ACTIVE
   ? "LOADFROMURL IS DOING ITS JOB..."
END WHILE

? "END OF JOB"

RETURN


PROC MYLOADFROMURL()

LOCAL LCHP

LCHP:=LOADFROMURL("http://www.unimep.br")

? LEN(LCHP)

RETURN

Jose Adriano Baltieri wrote:
> Hello !
> 
> I've posted this before but, here it goes again :
> 
> I need a smaller timeout for LoadFromUrl. It seems to me that it is 
> defaulting to the machine's browser timeout, which is generally 5 minutes.
> 
> Too much for me. So, I'd need either :
> 
> 1) To specify this timeout, somehow or
> 2) To have a non-blocking LoadFromUrl, possibly specifying a code block 
> to be evaluated WHILE it does its job.
> 
> Have you ever faced this situation ?
> 
> thanXs for your suPPort !
>