Mastering TS Net
J. Landman Gay
jacque at hyperactivesw.com
Sun Jul 1 14:00:44 EDT 2018
Does TSNet even work with local files? For local files use the read/write
commands or "get/put url".
With a commercial license you shouldn't need to deal with the lower level
functions for internet communication. The basic put, post, and get commands
should do it.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On July 1, 2018 10:21:38 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
More information about the use-livecode
mailing list