How to get files from FTP Server
I'm trying to get files from FTP server. Bellow my code:
set ftp = ##class(%Net.FtpSession).%New()
set ftp.Timeout = 5
set port = 21
If 'ftp.Connect(host,"USER","USER",port) Write ftp.ReturnMessage,! Quit sc
Write "Ftp server messsage:",!,ftp.ReturnMessage,!
If 'ftp.Binary() Write "Can not swap to binary mode",! Quit sc
Write "Mode now: ",ftp.Type,!
If 'ftp.Retrieve("512KB.zip",stream) Write "Failed to get file",! Quit sc
Write "Length of file received: ",stream.Size,!
If 'ftp.Logout() Write "Failed to logout",!
I'm getting error:
Unable to open connection to speedtest.tele2.net on port 21.