I'm trying to do async requests for a text files while a video is playing, but my simple test won't work, it always gets a response code of -10001, and the string is empty. The test url should (and does, when tested from a browser) return a simple text file.
I start the request using the function below, passing it the port that is also monitoring various video events (I'm calling it at some point while the video is already playing):
Function startAsyncRequest(port)
print "startAsyncRequest"
urlXfer = CreateObject("roURLTransfer")
urlXfer.setUrl("http://192.168.1.200/test123.txt")
urlXfer.setPort(port)
urlXfer.EnableEncodings(true)
if urlXfer.asyncGetToString() = true
print "successful asynchGetToString"
end if
end Function
Then, I call the below function at the appropriate part of the loop. It does get triggered (right after I called the function to make the request), and I see from the server logs that it has properly requested the file from my server.
Function showAsyncResult (msg)
if type(msg) = "roUrlEvent"
print "showAsynchResult"
print str(msg.GetResponseCode())
print "[" + msg.GetString() + "]"
end if
end Function
Here is what prints out:
startAsyncRequest
successful asynchGetToString
showAsynchResult
-10001
[]What am I doing wrong here? Obviously -10001 is not a valid http response code.
Thanks,
-rob