I like FTP. I have been using a free server for twenty years - only 200MB available storage, but my files are only 20-30k each. I use it to share data between apps and devices, even more now since sharing data via (Android) device storage is so restrictive. But recently the server was shut down for a while because of misuse by some users, and although I found a temporary alternative I realised that FTP is going out of fashion and I could not rely on a free service any more.
I am now setting up on a paid cloud storage provider (Ionos HiDrive) - still using FTP. I have my own small library that standardises my FTP interface and provides basic data synchronisation. All that is required to switch providers is to change the url etc - except that HiDrive provides SFTP and FTPS but not simple old FTP. I don't really understand how these two work, and that might be the source of my problem, which is this ...
I have a testbed for the library - it can exchange short or longer ASCII files (200byte and 2Mbyte) and a random binary data file (2Mbyte). Everything tested well, so I started deploying the updated library in my apps. Everything was still fine until I reached an app that runs on three devices (phone, tablet and PC) and shares a 34kbyte SQLite file. Occasionally the file transfers successfully but usually not; the file is truncated to 4k - 8k.
Here is the code that I am using to set up FTP (@schimanski helped me with this - he also uses HiDrive.)
Here are some other facts that might or might not be helpful . . .
1. I have transmitted 2MByte random binary files both ways and checked that the files returned match the files sent byte-for-byte; they always do.
2. I have transmitted and retrieved a 30MByte *.avi file without any problem - also *.mp3 files.
3. My desktop FTP client (I use CoffeeCup) transfers the SQLite file without problem. It says that it uses this protocol - "SFTP over SSH, standard port is 22".
4. HiDrive offers FTPS (explicit with TLS encryption) on port 21 and SFTP on port 22.
5. B4X gives me three options "UseSSL", "UseSSLExplicit" or neither of these. I do not know what these mean - I am just following the example given by @schimanski.
I have been working on and off on this for two weeks - any suggestions would be welcome. I am sure that I am missing something obvious.
I am now setting up on a paid cloud storage provider (Ionos HiDrive) - still using FTP. I have my own small library that standardises my FTP interface and provides basic data synchronisation. All that is required to switch providers is to change the url etc - except that HiDrive provides SFTP and FTPS but not simple old FTP. I don't really understand how these two work, and that might be the source of my problem, which is this ...
I have a testbed for the library - it can exchange short or longer ASCII files (200byte and 2Mbyte) and a random binary data file (2Mbyte). Everything tested well, so I started deploying the updated library in my apps. Everything was still fine until I reached an app that runs on three devices (phone, tablet and PC) and shares a 34kbyte SQLite file. Occasionally the file transfers successfully but usually not; the file is truncated to 4k - 8k.
Here is the code that I am using to set up FTP (@schimanski helped me with this - he also uses HiDrive.)
B4X:
' Initialise contact with FTP server
Private Sub setupFTP
FTP.Initialize("ftp", "ftp.hidrive.ionos.com", 21, "account", "password")
FTP.PassiveMode = True
FTP.UseSSLExplicit = True
makeFileList ' Check connection and list files
End Sub
Here are some other facts that might or might not be helpful . . .
1. I have transmitted 2MByte random binary files both ways and checked that the files returned match the files sent byte-for-byte; they always do.
2. I have transmitted and retrieved a 30MByte *.avi file without any problem - also *.mp3 files.
3. My desktop FTP client (I use CoffeeCup) transfers the SQLite file without problem. It says that it uses this protocol - "SFTP over SSH, standard port is 22".
4. HiDrive offers FTPS (explicit with TLS encryption) on port 21 and SFTP on port 22.
5. B4X gives me three options "UseSSL", "UseSSLExplicit" or neither of these. I do not know what these mean - I am just following the example given by @schimanski.
I have been working on and off on this for two weeks - any suggestions would be welcome. I am sure that I am missing something obvious.
Last edited: