Android Question FTP_ProgressionDownload Funny

Fabrice La

Active Member
Licensed User
Longtime User
I have something funny append.
I am using FTP and download file size of 14 Mb

When i run FTPflcc.DownloadFile("share/" & filetoDownload,True,fullpath2, filetoDownload)

in FTP_ProgressionDownload I log :
Dim s As String
s = "Downloaded " & Round(TotalDownloaded / 1000) & "KB"
Dim sizeFileL As Long
sizeFileL = sizeFile.Text + 0
If sizeFileL > 0 Then s = s & " out of " & Round(sizeFileL / 1000) & "KB"
Log(s)
DoEvents

and go for ever and never finish (in the ftp server the file is downloaded in 2mn) with :

Downloaded 0KB out of 11479KB


Downloaded 1KB out of 11479KB


Downloaded 21KB out of 11479KB
Downloaded 22KB out of 11479KB
Downloaded 23KB out of 11479KB
Downloaded 29KB out of 11479KB
Downloaded 34KB out of 11479KB
Downloaded 30KB out of 11479KB
Downloaded 24KB out of 11479KB
Downloaded 42KB out of 11479KB
Downloaded 35KB out of 11479KB
Downloaded 45KB out of 11479KB
Downloaded 25KB out of 11479KB
Downloaded 26KB out of 11479KB
Downloaded 27KB out of 11479KB
Downloaded 2KB out of 11479KB
Downloaded 52KB out of 11479KB
Downloaded 3KB out of 11479KB
Downloaded 39KB out of 11479KB
Downloaded 4KB out of 11479KB
Downloaded 5KB out of 11479KB


Downloaded 56KB out of 11479KB
Downloaded 6KB out of 11479KB
Downloaded 37KB out of 11479KB
Downloaded 7KB out of 11479KB
Downloaded 8KB out of 11479KB
Downloaded 9KB out of 11479KB
Downloaded 10KB out of 11479KB
Downloaded 11KB out of 11479KB
Downloaded 40KB out of 11479KB
Downloaded 38KB out of 11479KB
Downloaded 51KB out of 11479KB
Downloaded 28KB out of 11479KB
Downloaded 32KB out of 11479KB
Downloaded 12KB out of 11479KB
Downloaded 13KB out of 11479KB
Downloaded 80KB out of 11479KB
Downloaded 41KB out of 11479KB
Downloaded 33KB out of 11479KB
Downloaded 65KB out of 11479KB
Downloaded 77KB out of 11479KB


Downloaded 14KB out of 11479KB
Downloaded 83KB out of 11479KB
Downloaded 15KB out of 11479KB
Downloaded 15KB out of 11479KB
Downloaded 47KB out of 11479KB
Downloaded 16KB out of 11479KB
Downloaded 17KB out of 11479KB
Downloaded 46KB out of 11479KB
Downloaded 64KB out of 11479KB
Downloaded 59KB out of 11479KB
Downloaded 55KB out of 11479KB
Downloaded 31KB out of 11479KB
Downloaded 97KB out of 11479KB
Downloaded 118KB out of 11479KB
Downloaded 43KB out of 11479KB
Downloaded 36KB out of 11479KB
Downloaded 123KB out of 11479KB
Downloaded 18KB out of 11479KB
Downloaded 124KB out of 11479KB
Downloaded 101KB out of 11479KB
Downloaded 60KB out of 11479KB


Downloaded 108KB out of 11479KB
Downloaded 93KB out of 11479KB
Downloaded 85KB out of 11479KB
Downloaded 68KB out of 11479KB
Downloaded 69KB out of 11479KB
Downloaded 145KB out of 11479KB
Downloaded 62KB out of 11479KB
Downloaded 113KB out of 11479KB
Downloaded 61KB out of 11479KB
Downloaded 70KB out of 11479KB
Downloaded 102KB out of 11479KB
Downloaded 103KB out of 11479KB
Downloaded 19KB out of 11479KB
Downloaded 87KB out of 11479KB


Downloaded 131KB out of 11479KB
Downloaded 134KB out of 11479KB
Downloaded 139KB out of 11479KB
Downloaded 182KB out of 11479KB
Downloaded 79KB out of 11479KB
Downloaded 67KB out of 11479KB
Downloaded 116KB out of 11479KB
Downloaded 100KB out of 11479KB
Downloaded 155KB out of 11479KB
Downloaded 119KB out of 11479KB


Downloaded 183KB out of 11479KB
Downloaded 142KB out of 11479KB
Downloaded 174KB out of 11479KB
Downloaded 169KB out of 11479KB
Downloaded 194KB out of 11479KB
Downloaded 122KB out of 11479KB
Downloaded 243KB out of 11479KB
Downloaded 165KB out of 11479KB
Downloaded 136KB out of 11479KB
Downloaded 233KB out of 11479KB


Downloaded 249KB out of 11479KB
Downloaded 192KB out of 11479KB
Downloaded 212KB out of 11479KB
Downloaded 228KB out of 11479KB
Downloaded 221KB out of 11479KB
Downloaded 44KB out of 11479KB


Downloaded 158KB out of 11479KB
Downloaded 271KB out of 11479KB
Downloaded 314KB out of 11479KB
Downloaded 63KB out of 11479KB
Downloaded 82KB out of 11479KB


Downloaded 285KB out of 11479KB
Downloaded 376KB out of 11479KB
Downloaded 337KB out of 11479KB
Downloaded 207KB out of 11479KB


Downloaded 201KB out of 11479KB
Downloaded 129KB out of 11479KB
Downloaded 259KB out of 11479KB
Downloaded 146KB out of 11479KB


Downloaded 349KB out of 11479KB
Downloaded 426KB out of 11479KB
Downloaded 279KB out of 11479KB


Downloaded 564KB out of 11479KB
Downloaded 409KB out of 11479KB


Downloaded 605KB out of 11479KB
Downloaded 20KB out of 11479KB


Downloaded 718KB out of 11479KB
Downloaded 244KB out of 11479KB


Downloaded 464KB out of 11479KB
Downloaded 487KB out of 11479KB


Downloaded 748KB out of 11479KB


Downloaded 444KB out of 11479KB


Downloaded 731KB out of 11479KB


Downloaded 817KB out of 11479KB


Downloaded 945KB out of 11479KB


Downloaded 678KB out of 11479KB


Downloaded 509KB out of 11479KB


Downloaded 917KB out of 11479KB


Downloaded 641KB out of 11479KB

......
 

DonManfred

Expert
Licensed User
Longtime User
did you app changing the orientation in the meamtime? If the download placed in activity_resume or *_created ? then due to a orienttion-change the download will started again.
 
Upvote 0

Fabrice La

Active Member
Licensed User
Longtime User
No I don't move the tablet and it's in click Button not on activity_resume or *_created

It does the same in Upload keep in progress for ages .....
 
Last edited:
Upvote 0

Fabrice La

Active Member
Licensed User
Longtime User
My code

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim FTPflcc As FTP
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("Main")
    If FirstTime Then
   
    End If
    If FTPflcc.IsInitialized = False Then FTPflcc.Initialize("FTP","10.230.52.181",21,"login","Password")
    ProgressDialogShow("Uploading " & "..." & ", please wait...")
    FTPflcc.UploadFile(File.DirRootExternal & "/share/","Divers" & ".zip",False,"/share/" & "Divers" & ".zip")
End Sub
Sub FTP_UploadProgress (ServerPath As String, TotalUploaded As Long, Total As Long)
    Dim s As String
    s = "Uploaded " & Round(TotalUploaded / 1000) & "KB"
    If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
    Log(s)
    DoEvents
End Sub
Sub FTP_UploadCompleted (ServerPath As String, Success As Boolean)
    Log(ServerPath & ", Success=" & Success)
    If Success = False Then Log(LastException.Message)
    Msgbox("Export, Success=" & Success, ServerPath)
    ProgressDialogHide
    FTPflcc.Close
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Can someOne try it ....
I am using Filezila Server and the file to upload is 14Mb size
 
Upvote 0

Fabrice La

Active Member
Licensed User
Longtime User
I am using the "Automated FTP Library" and solve problems.

I am using both with "Net library" because "Automated FTP Library" need some feature

But my appli is working now ...
 
Upvote 0
Top