How to use tsNet to connect to an FTP server over SSL (FTPS)
Introduction
Many FTP servers support connecting via SSL (FTPS) as this means that any authentication details are sent over the Internet in an encrypted manner rather than being transmitted in plain text. Using tsNet to connect via FTPS is just as simple as any other connection type.
This lesson shows how to retrieve a directory listing from an FTP server by connecting to it over SSL.
Lay out the Stack
Create a new stack then drag a button and two fields onto it.
Set the name of the fields to "Output" and "Server Response".
Save this stack.

Create the Script
Edit the script of the button that you placed on the stack by right clicking on the button and selecting "edit script".
Add the following code.
on mouseUp pMouseButton
-- Store the FTP server details in some variables
put "ftp://test.rebex.net" into tFtpServer
put "/pub/example/" into tFtpDirectory
-- The tSettings array can be used to provide additional configuration details, in this case
-- the username and password to use when transferring the files via FTP
put "demo" into tSettings["username"]
put "password" into tSettings["password"]
-- To force FTP SSL mode, we use the following additional setting
put true into tSettings["use_ssl"]
-- Let the user know that the transfer is starting
put "Downloading FTPS directory listing for" && tFtpDirectory && "from" && tFtpServer & cr into field "Output"
-- Perform the upload
put tsNetGetSync(tFtpServer & tFtpDirectory, tHeaders, tRecvHeaders, tResult, tBytes, tSettings) into tOutput
-- Output the response to the user
put "Transfer complete with server response code" && tResult after field "Output"
put tOutput into field "Server Response"
end mouseUp
Test
Switch to Run mode and click the button.

More information
As can be seen in the code above, there is only one line of code needed to ensure that the FTP connection is performed over SSL.
In this instance, setting tSettings["use_ssl"] to true is all that is needed. This forces the connection to use what is called "explicit FTPS" which is the most common form of FTP encryption. Note that the connection string contained in tFtpServer still starts with "ftp://".
This additional line is not needed if the server you are connecting to only supports the deprecated "implicit FTPS" connection method. To connect via implicit FTPS, use "ftps://" intead of "ftp://" in your connection string.
The demo fails. I cannot get this working with my own server credentials no matter what I do. The port is wrong as well. Comes up as 21 - should be 22 for ssh and scp (although we will change it once everything is working)
Please advise.
Mike