Page 1 of 1
					
				Wrong informations about Indy edition and SFTP?
				Posted: Wed May 01, 2019 2:28 pm
				by Zax
				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 :
Now, when I'm trying to upload files with SFTP using tsNet, I see in LC lessons that SFTP requires the 
Business editon!
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.
 
			 
			
					
				Re: Wrong informations about Indy edition and SFTP?
				Posted: Wed May 01, 2019 3:03 pm
				by heatherlaine
				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
			 
			
					
				Re: Wrong informations about Indy edition and SFTP?
				Posted: Thu May 02, 2019 9:17 am
				by Zax
				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.
 
			 
			
					
				Re: Wrong informations about Indy edition and SFTP?
				Posted: Thu May 02, 2019 2:54 pm
				by Zax
				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.
 
			 
			
					
				Re: Wrong informations about Indy edition and SFTP?
				Posted: Fri May 03, 2019 10:01 am
				by charlesBUSd8qF
				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
			 
			
					
				Re: Wrong informations about Indy edition and SFTP?
				Posted: Fri May 03, 2019 2:03 pm
				by Zax
				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 
