Android Question FTP Problem - B4A 9.90

cirollo

Active Member
Licensed User
Longtime User
Hi!

after upgrading I'm having the following problem:

I download via FTP some jpgs, randomly the transfer stops

I use Filezilla Server and I get:
(003217)19/07/2020 19:44:53 - b2bgemitex (93.41.228.147)> 150 Opening data channel for file download from server of "/immagini/JACQ05.jpg"
(003217)19/07/2020 19:44:54 - b2bgemitex (93.41.228.147)> 425 Can't open data connection for transfer of "/immagini/JACQ05.jpg"

but on the B4A log I cannot trap this event because I see only the last transfer with success (JACQ04.jpg is the previous file):

B4X:
......
JACQ01.jpg - true
JACQ02.jpg - true
JACQ03.jpg - true
JACQ04.jpg - true

using a previous version of B4A (6.80), at this time I get a timeout error, with this version nothing happens!
How can I trap this event?

this is my code btw

B4X:
Sub ScaricaImmagini
    Log(ftpjobs.Size)
    Dim ok As Boolean
    ok = True
    For i = 0 To ftpjobs.Size-1
        If ok = True Then
            Try
                FTP.DownloadFile("/immagini/"&ftpjobs.Get(i), False, sdRoot&"/img/", ftpjobs.Get(i))
                Wait For FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
                Log(ftpjobs.Get(i)&" - "&Success)
                CircularProgressBar1.Value = (totimmagini-(i+1))
                If ChkLog.Checked=True Then
                    TxtLog.Text = "Download file "&(i+1)&" di "&totimmagini&" "&ServerPath &" completato"&Chr(10)&TxtLog.Text
                End If
                If Success = False Then
                    File.Delete(Main.sdRoot&"emmeci/gemitex/img/",ftpjobs.Get(i))
                    ok = False
                    Exit
                Else
                    'Sleep(500)
                End If
            Catch
                ok = False
                Exit
            End Try
        End If
    Next
    FTP.Close
    CircularProgressBar1.Value = 100
    If     ok = False Then
        Msgbox2("Errore di Collegamento, Riprovare!",Main.nomeprog,"","Ok","",LoadBitmap (File.DirAssets, "warning_gemitex.png"))
    Else
        Msgbox2("Ricezione completata!",Main.nomeprog,"","Ok","",LoadBitmap (File.DirAssets, "warning_gemitex.png"))
    End If
    TxtLog.Visible = False
    LblStatus.Visible = False
    Awake.ReleaseKeepAlive 'togliamo lo standby
    BtnInvia.Enabled = True
    BtnRicevi.Enabled = True
    BtnExit.Enabled = True
    Activity.Finish
    StartActivity(Main)
End Sub
 

cirollo

Active Member
Licensed User
Longtime User
solved!

I was using NET 1.20, upgrading to NET 1.80 and setting Timeoutms seems to work!
 
Upvote 0
Top