On 12 Jun 2007, at 17:11, David Bovill wrote:
You can load a url and you can do asynch ftp upload - but how about
if you
want to send a large amount of data to a remote location without
using ftp?
Can you do an "asynch post"? I guess you could do an asynch ftp
upload and
then a quick sychronous post on completion - any thoughts?
If by "asynch" you mean keeping your application alive and running
while the posts take place, it should be possible. The posts would
occur sequentially, but your application should still be responsive
during the transfers. Although "post" is described as "blocking" it
only blocks the script it is called in. Other scripts can run at the
same time.
The approach taken would depend on your circumstances, but the idea
is to set up some "out of synch" psuedo thread to handle the posts.
The simplest way to do this might be using a "send ... in time"
message. You can use liburlSetStatusCallback to display progress if
needed.
Rough idea (untested):
local postUrlQ
local asynchPostRunning = false
on someHandler
---code
-- code
asynchPost someUrl, someData
-- code
-- code
end someHandler
on asynchPost purl, pData
put pUrl & return after postUrlQ
if not asynchPostRunning then
send asynchPostHandler to me in 0 milliseconds
end if
end asynchPost pUrl
on asynchPostHandler
if not asynchPostRunning AND the number of lines of postUrlQ > 0 then
put line 1 of postUrlQ into tUrl
delete line 1 of tUrl
put true into asynchPostRunning
post pData to url pUrl
put it into tRetData
put the result into tRes
if tRes <> empty then
## error handling
## maybe send a callback message
else
## success routine, do something with tData
## maybe send callback
end if
put false into asynchPostRunning
if the number of lines of postUrlQ > 0 then
send asynchPostHandler to me in 0 milliseconds
end if
end if
end asynchPostHandler
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution