I'm using the same FTP routine to download a number of images from my webserver. I've displayed the relevant code below.
The very strange thing is that the code is idential to the B4A implementation which I've been using for years. Yet on B4i, the download usually stop around 40-50 images in, and after that my website crashes. I have contacted the hosting company too to see if there is a reason for this, but I was wondering if anyone could explain what the differences are between android and iOS and a suggested workaround (e.g. I was thinking perhaps putting a delay in between downloads, but this is obviously creating extra inefficiency)
The very strange thing is that the code is idential to the B4A implementation which I've been using for years. Yet on B4i, the download usually stop around 40-50 images in, and after that my website crashes. I have contacted the hosting company too to see if there is a reason for this, but I was wondering if anyone could explain what the differences are between android and iOS and a suggested workaround (e.g. I was thinking perhaps putting a delay in between downloads, but this is obviously creating extra inefficiency)
B4X:
totalDownloads=0
Dim thisFTP As FTP
thisFTP.Initialize("thisFTP",FTP_images_address, FTP_images_port, FTP_images_username, FTP_images_password)
For i=0 To missingFileList.Size-1
Dim thisFile As Map
thisFile=missingFileList.Get(i)
' check we haven't already downloaded it (another point might be using it)
If (MiscUtils.isFilePresent(thisFile.Get("directory")&"/"&thisFile.Get("filename")) = False) Then
File.MakeDir(File.DirDocuments,thisFile.Get("directory"))
' create directory if it doesn't exist
Dim directoryPath As String
directoryPath = File.DirDocuments & "/"&thisFile.Get("directory")
If File.Exists(directoryPath, "") = False Then File.MakeDir(File.DirDocuments,thisFile.Get("directory"))
thisFTP.DownloadFile("./"&thisFile.Get("directory")&"/"&thisFile.Get("filename"),False,File.DirDocuments&"/"&thisFile.Get("directory"),thisFile.Get("filename"))
Else
Log("File ALREADY DOWNLOADED ON THIS DOWNLOAD CYCLE")
End If
Next
Sub thisFTP_DownloadCompleted (ServerPath As String, Success As Boolean)
' great - move onto next one
End Sub