I am trying to use the asyncronous methods of roUrlTransfer and have couple of questions i could not find in RTFM the answer to:
Are the Async methods re-entrant? E.g. can i call AsyncGetToString() multiple times on the very same object and rely it will not bomb - that is >1 async calls from the same object can run in the background and will send events. Or are roUrlTransfer objects strictly one-time/single-use/disposable.
Is it okay not to hold a reference to a roUrlTransfer object after the Async method was called? Or should i hold on for dear life to the object, even if i am not going to use it - lest it will explode in my face.
As an explanation of use, i intend to start multiple transfers in parallel - and if (1) Async calls are re-entrant, i may just use a single roUrlTransfer object and sort out the results based on roUrlEvent only. If that is not the case, then i'll use 1 roUrlTransfer per 1 async call and then (2) becomes relevant - do i need to keep reference to these objects (like stuff them in array for no reason of my own but just to keep ref.count > 0) - or can i invalidate my reference (like say using the same variable in a loop, re-assigning it with createObject() on each iteration) and trust Roku will still finish the async calls?
PS. bonus question - how many roUrlTransfer requests maximum before player meets untimely demise?
ifUrlTransfer.GetIdentity() correlates to roUrlEvent.GetSourceIdentity(), and as far as I'm aware, that's the only way to identify which request a given roUrlEvent relates to. You should be able to re-use an roUrlTransfer object, but not concurrently with other requests from the same instance.
The request gets disposed as soon as the roUrlTransfer goes out of scope, so if you don't keep a reference to the object, you'll lose most, if not all, of the requests.
Later I got to the same practical conclusions on (1) and (2) after some trial & error. @Roku people: but this should be documented, no? - not at all obvious.
I used .getIdentity() to maintain a "stable" of a few hundred workhorse roUrlTransfers, because in my case the answer to (3) seemed to be ~1000 (YAWRR: thereabout a thousand requests will crash & reboot a Roku3). Takes some effort to manage them but the amount of grazing these - ok, so maybe "work-goats" - can do is impressive!