Load URL doesn't send message

J. Landman Gay jacque at hyperactivesw.com
Fri Jul 29 16:22:49 EDT 2005


Dave Cragg wrote:
> 
> On 29 Jul 2005, at 03:33, J. Landman Gay wrote:
> 
>> I'm using libURL 1.1.3b1 (apparently what ships with 2.6) and can't  
>> get a message when the URL is done. I'm trying:
>>
>>  load url tURL with message "myMsg"
>>
>> No message is sent. Is it just me?
> 
> 
> It's just you, Jacque. I'm going back to bed.

Well, you're smarter than I am, because I've been at this for a couple 
of days now without any progress. What I seem to be getting is lots of 
empty status messages. What do those mean?

> The things that could cause the message not to be sent that I can  think 
> of:
> 
> An "unload url" or clearing of  the pendingMessages after the message  
> has been sent but before it is handled. The likely place for this  kind 
> of thing would be in the status callback handler. After a  succesful 
> load, the final  callback message gets sent just before the  "load 
> message", both sent in 0 milliseconds. So if your callback  handler does 
> one of these things when the status is "downloaded", the  message won't 
> get sent.
> 
> So I'd look at the callback handler first.

I'm not doing either of those things so that isn't it.

What does it mean if the status is always empty? That is what I seem to 
be getting. Then my status checking handler runs like mad but doesn't do 
anything.

I've simplified my script a lot for testing. This is what I'm using at 
the moment:

on downloadFile tURL
   unload url tURL -- just for testing, so I can reuse it
   load url tURL with message "saveFile"
   get the result
   if it <> "" then answer it
   checkStatus tURL
end downloadFile

on checkStatus tURL
   put urlStatus(tURL) into tStatus
   if tStatus contains "loading" then
     set the endValue of sb "progress" to item -1 of tStatus
     set the thumbPos of sb "progress" to item -2 of tStatus
   else
     put tStatus
   end if
   if tStatus is not among the items of "cached,error,timeout" then
     send "checkStatus" to me in 50 milliseconds
   end if
end checkStatus

on saveFile tURL,tStatus
   answer "SAVEFILE MESSAGE RECEIVED"
end saveFile

Nothing happens at all, except for the pending message that goes 
repeatedly until I manually cancel it. Setting a breakpoint always shows 
that tStatus is empty (which is why the script runs away with itself.) 
The file doesn't come through usually. Sometimes it does.

It isn't my connection, because I can run RevNet or Eric's sample 
tutorial and they work fine and their progress bars move. However, 
neither of these use a callback message. I can make mine work too if I 
don't use a callback message, and if I instead check for a "cached" 
status and act on that.

Same behavior with any URL I try, including "http://www.google.com", so 
it isn't the URL. Also, same behavior if I comment out the "checkStatus" 
call and just wait for a confirmation from "saveFile". I don't get one.


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list