Wrong informations about Indy edition and SFTP?

Something you want to see in a LiveCode product? Want a new forum set up for a specific topic? Talk about it here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Zax
Posts: 103
Joined: Mon May 28, 2007 10:12 am
Location: France

Wrong informations about Indy edition and SFTP?

Post by Zax » Wed May 01, 2019 2:28 pm

Sorry if this post is not in the right section, but I don't understand something about LC networking abilities.

I used to use the Community edition for my personal use. As I wanted to use SFTP, I bought the Indy edition after reading on LC website that Indy edition offers SFTP :
LC_licenses.jpg
LC_networking.jpg
Now, when I'm trying to upload files with SFTP using tsNet, I see in LC lessons that SFTP requires the Business editon!
LC_lesson.jpg
Same limitation can be read on Tech Strategies website, in tsNetGetFile() function documentation.

It seems that only FTPS is allowed by the Indy edition. So, I would like to know if I bought the Indy version for nothing, relying on a wrong information, or if there is something that I did not understand.

Thank you.

heatherlaine
Site Admin
Site Admin
Posts: 312
Joined: Thu Feb 23, 2006 7:59 pm

Re: Wrong informations about Indy edition and SFTP?

Post by heatherlaine » Wed May 01, 2019 3:03 pm

You can use sFTP in Indy, but only for blocking actions, not asynchronously. Its the asynchronous feature that requires Business.

I hope this helps,

Regards,

Heather
Customer Services Manager
LiveCode Ltd

Zax
Posts: 103
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Wrong informations about Indy edition and SFTP?

Post by Zax » Thu May 02, 2019 9:17 am

OK, I understand. Thank you for your reply, Heather.

It's confusing because tsNetUploadFileSync() function sometimes causes a script error "execution error at line n/a (external: unlicensed) near "tsNet".
For example :

Code: Select all

put "/Volumes/SSD/myFile.txt" into tFileToUpload
put "myFile.txt" into tFileName

put "/pathToDistantDirectory/" into tFtpDirectory
put "theUser" into pSettings["username"]
put "thePassword" into pSettings["password"]
put true into pSettings["use_ssl"]

put "sftp://ssh.mySharedHost.com:22" into tFtpServer

local tHeaders, tResultCode, tBytes, tRecvHeaders, tResult
tsNetUploadFileSync(tFileToUpload, tFtpServer & tFtpDirectory & slash & tFileName, tHeaders, tRecvHeaders, tResultCode, tBytes, pSettings) into tResult
script error --> execution error at line n/a (external: unlicensed) near "tsNet"

Code: Select all

put "ssh://ssh.mySharedHost.com:22" into tFtpServer
--> tsneterr: (1) Protocol "ssh" not supported or disabled in libcurl

Code: Select all

put "ftp://ssh.mySharedHost.com:22" into tFtpServer
--> tsneterr: (28) Operation timed out


And if I use working settings in my FTP client:

Code: Select all

put "ssh.mySharedHost.com:22" into tFtpServer
--> tsneterr: (56) Recv failure: Connection reset by peer

As it's a shared hosting service (OVH), I can't modify server's settings. Anybody can tell me what am I doing wrong?

Thank you.

Edit
I just tried the following with the console:

Code: Select all

sftp theUser@ssh.mySharedHost.com:{remote_dir} <<< $'put {local_file_path}'
Password is of course asked, but uploading works.

Zax
Posts: 103
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Wrong informations about Indy edition and SFTP?

Post by Zax » Thu May 02, 2019 2:54 pm

Zax wrote:
Thu May 02, 2019 9:17 am
put "sftp://ssh.mySharedHost.com:22" into tFtpServer

local tHeaders, tResultCode, tBytes, tRecvHeaders, tResult
tsNetUploadFileSync(tFileToUpload, tFtpServer & tFtpDirectory & slash & tFileName, tHeaders, tRecvHeaders, tResultCode, tBytes, pSettings) into tResult[/code]
script error --> execution error at line n/a (external: unlicensed) near "tsNet"
After several tests, and looking sample_sync_stack.livecode's code, I found using tsNetUploadSync instead of tsNetUploadFileSync with an URL like "sftp://..." works and doesn't trigger a script error with the Indy version...
So, my problem is solved but this behavior looks a little strange.

charlesBUSd8qF
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 38
Joined: Wed Apr 11, 2012 10:28 pm

Re: Wrong informations about Indy edition and SFTP?

Post by charlesBUSd8qF » Fri May 03, 2019 10:01 am

Hi,

The Indy version of LC (and the included tsNet networking library) does not support transferring data via SFTP or SMTP directly to or from a file on the local system. You need to transfer the data using variables (storing/reading the file data via a variable) and perform any local file system operations separately. This means, for example, that the tsNetUploadSync function works in Indy for SFTP transfers, but not the tsNetUploadFileSync function.

This limitation doesn’t exist in the Business edition of LC.

Hope that helps,

Charles

Zax
Posts: 103
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Wrong informations about Indy edition and SFTP?

Post by Zax » Fri May 03, 2019 2:03 pm

Hello Charles,
charlesBUSd8qF wrote:
Fri May 03, 2019 10:01 am
The Indy version of LC (and the included tsNet networking library) does not support transferring data via SFTP or SMTP directly to or from a file on the local system.
That's what I finally found after numerous tests!... And It's different from what Heather replied:
heatherlaine wrote:
Wed May 01, 2019 3:03 pm
You can use sFTP in Indy, but only for blocking actions, not asynchronously. Its the asynchronous feature that requires Business.
Once again, I finally used SFTP with my Indy version, so I no longer have problems, but I think documentation could be a little more accurate ;)

Post Reply

Return to “Feature Requests”