Android Question problem FTP over TLS 1.2

fargoz

Member
Licensed User
Longtime User
Hello
I have problems configuring FTP over TLS 1.2
What would be the correct way?
my code is as follows
B4X:
  FTP.Initialize ("FTP", FTPServerName, Serverserver, LoginServer, PasswordServer)
    ctm.InitializeAcceptAll
    FTP.SetCustomSSLTrustManager (ctm)
    FTP.PassiveMode = True
    FTP.UseSSL = False
    FTP.UseSSLExplicit = True
    FTP.DownloadFile (FolderRemote & MDATOSZIP, False, External Path, MDATOSZIP)
    FTP.TimeoutMs = 80000
    FTP.Close ()
but the error message is:
org.apache.commons.net.ftp.ftpConnectionClosedException: Connection closed without indication
 
Last edited:

fargoz

Member
Licensed User
Longtime User
hello Erel
Thank you very much for answering ... the server provider demands that the communications be post FTPS or SFTP with its FTP Client.
I tried to do it with the following code but it generates an error. which may be ?

(FTPConnectionClosedException) org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.


B4X:
   FTP.Initialize("FTP", NombreServerFTP,PuertoServer,LoginServer, PasswordServer)
   ctm.InitializeAcceptAll
   FTP.SetCustomSSLTrustManager(ctm)
   FTP.PassiveMode=True
   FTP.UseSSLExplicit = True

   FTP.DownloadFile(CarpetaRemota & MDATOSZIP, False, RutaExterna, MDATOSZIP)
   Wait For FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
   If Success Then
      Log("Archivo Bajado exitosamente! ")
    Else
        Log("Problema al bajar archivo")
        Log(LastException)  
           ' LastException = (FTPConnectionClosedException) org.apache.commons.net.ftp.FTPConnectionClosedException: Connection closed without indication.
    End If
   FTP.Close()
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
SFTP has nothing to do with FTP. You can use this library for SFTP: https://www.b4x.com/android/forum/threads/26994/#content

There are two types of FTPS: FTPS implicit (UseSSL) and FTPS explicit (UseSSLExplicit). Try it with UseSSL.

Make sure that you are using the correct port. It will be a different port for the different services.
 
Upvote 0
Top