AsyncGetToString works well on Express but poorly on Ultra
I use the following code get the contents of a small (<100 bytes) text file whose content may change frequently; it is checked multiple times per minute.
url="http://<-webpage-address->info.txt"
settings=getFileString(url)
...
function getFileString(url)
timeout=1000
fileString=""
http = CreateObject("roUrlTransfer")
http.SetPort(CreateObject("roMessagePort"))
http.SetUrl(url)
if http.AsyncGetToString()
event = wait(timeout, http.GetPort())
if type(event) = "roUrlEvent" then
fileString = event.GetString()
elseif event = invalid then
http.AsyncCancel()
end if
end if
return fileString
end function
On a Roku Express I get a non blank return (the contents of the info.txt file) on virtually every call to getFileString(). A Roku Ultra call to getFileString() almost always returns a blank string ""; i.e. it could take one or more typically hundreds of calls (sometimes never) to get a non-blank string return.
My roku specifics:
3910RW Roku Express, software 10.0.0 build 4209-51
4670X Roku Ultra, softwate 10.0.0 build 4209-46
Why does this work consistently well on the Express but almost always fail on the Ultra?