Mastering TS Net
Sannyasin Brahmanathaswami
brahma at hindu.org
Mon Jul 2 09:36:00 EDT 2018
@Charles: Thanks, I look into lessons.
But, using the dictionary example
Why do we get the
> # variable watcher
>
> tResult -- tsneterr: ID already in use
Even *before* the trace the script? I have break
On mouseup
But it gives this error even before starting the trace?
@ Jacqueline: why use TSNet:
1) because the "libURLLastRHHeaders()" are only available to desktop. And I want to see them on mobile
2) because we are working with the "cloud" and async download means I can pass array to TSNet to open connection to download several files at once; like "load" but with more control... ( I think. I have yet to study it out) and get the headers.
Brahmanathaswami
On 7/1/18, 3:40 PM, "use-livecode on behalf of Charles Warwick via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:
Hi BR,
There are a series of lessons on tsNet on the LiveCode website:
http://lessons.livecode.com/m/4071/c/235433
If you are looking for an example of how to download something direct to a file, the lesson called “How to asynchronously download via SFTP directly a file” should help.
The same concepts apply for downloading to a file regardless of the protocol being used.
If you can’t quite find an example lesson that answers what you need, let me know and I will get one organised.
Regards,
Charles
> On 2 Jul 2018, at 1:19 am, Sannyasin Brahmanathaswami via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> I really need to get my head around TSNet, so began experiments.
>
> This is the documentation for tsNetGetFile
>
> " local tHeaders, tResult
>
> put tsNetGetFile("1", "/path/to/downloaded/file.dat", \
> "ftp://user:pass@ftp.example.com/file.dat", tHeaders, \
> "transferComplete") into tResult
>
> on transferComplete pID, pResult, pBytes, pCurlCode
> local tData, tHeaders
> if pCurlCode is not 0 then
> answer tsNetRetrError(pID)
> else
> a nswer "File has been downloaded"
> end if
> tsNetCloseConn pID
> end transferComplete
>
> # but my first attempt to "get it" ... ran into this error.
>
> Are there any good lessons on all TSNet functions?
> I am not looking forward to wading into this blind as a bat.
>
> # variable watcher
>
> tResult -- tsneterr: ID already in use
>
> what is strange is this, the IDE gives the error even before tracing the mouseup.
>
> So I did not even get off home plate.
>
> ############
> local tHeaders, tResult
>
> on mouseup
> # put a break here... the IDE show an error *before* stepping into the next statement
> # I can't even close the connection with:
> tsNetCloseConn "1"
> put empty into tResult
> put fld aURL into pURL
> put empty into fld "fldHTTPHeader"
> put empty into fld "tHTMLfield"
> set the itemDel to "/"
> put item -1 of pURL into tFileName
> put ("~/Desktop/"&tFileName) into tLocalFile
> put tsNetGetFile("1",tLocalFile,pURL,tHeaders,"transferComplete") into tResult
>
> -- put libURLLastHTTPHeaders() into fld "fldHTTPHeader"
> end mouseup
>
> on transferComplete pID, pResult, pBytes, pCurlCode
> if pCurlCode is not 0 then
> answer tsNetRetrError(pID)
> else
> answer "File has been downloaded"
> put tHeaders into fld "fldHTTPHeader"
> end if
> tsNetCloseConn pID
> end transferComplete
>
> BR
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list