Among the functions of the application I'm developing is one that connects to an FTP server and sends the database (.db) to it. Afterwards, it takes this database again (a remote backup).
Everything works perfect though, just over wifi. If I'm on the street only with a 4G connection, it doesn't work. Generates an error.
The difficulty is even in having access to the log, since the failure only occurs using the 4G connection. When I turn off the Wifi to be able to test on 4G, I don't have the debug on my computer.
Is you FTP server at your home or in a internet host?
If it's at home, are you able to access your FTP server from outside? Have you try it with an FTP client (i.e. Filezilla) to check if you need to open ports in your router?
Is you FTP server at your home or in a internet host?
If it's at home, are you able to access your FTP server from outside? Have you try it with an FTP client (i.e. Filezilla) to check if you need to open ports in your router?
The FTP server is an external host service. Testing with 4g through other applications (Solid Explorer etc) works, only with what I'm doing in B4A that doesn't.
Hi guys! I solved it through an example I found on the forum about something else, but it had a code to use FTP.
I'll leave the solution here in case anyone needs it. I must emphasize that I do not understand what this class that is used does and why it works on wifi but not on 4 g without it. Anyway, solve it!
B4X:
Dim ftp As FTP
Dim ctm As CustomTrustManager ' <<<<<<<<<<< This
ctm.InitializeAcceptAll
ftp.Initialize("ftp", "ftpserver", 21, "login", "password")
ftp.PassiveMode = True
ftp.UseSSLExplicit = True
ftp.SetCustomSSLTrustManager(ctm) ' <<<<<<<<<<< This
ftp.UploadFile (File.DirAssets, "smile.jpg", False, "smile.jpg")