Android Example FTP Example using a "Download-Queue"

It began in the english Forum.

In the english part of the forum i wrote an ftp example for @schimanski a few days ago which uses a "FTP Download Queue". all files are put into a list and after that they are downloaded each one after another (using one download at the same time).

I have extended this example a little bit. Now it is first do a LIST-Command (list all files in a defined folder on FTP) and all files listed are put into the downloadqueue. After that all files from the queue are downloaded one after another.

I made some design-changes also.



label1 would be used to show progress of the downloaded files.
lv would be uses to show results of each file. Files downloaded without error are marked with a GREEN item. red marked items are the one where an error occurs.
There is one entry in downloadqueue which does not exists. I made this knowingly due to demonstrate such a situation.



If all files are downloaded (doesnt matter with or without errors) the following code gives you an overview over all made downloads.

B4X:
For i = 0 To jobresults.Size -1
    Log(jobresults.Get(i))
Next
Inside this you will find informations of each file


Attached you will find my small example. It´s optimizeable i´m sure (i´m still in learning-phase of B4A ) but it may help some of you finding a nice example i suppose.
 

Attachments

  • ftpqueue.zip
    9.4 KB · Views: 1,344
Last edited:

Luis Alberto Perez

New Member
Licensed User
Longtime User
Hello. I am new to B4A. I have a problem when testing your code. It gives me an error (Username/passwrod type). I asume that you can not give out that information (private).
Can you help me finding an ftp server (free for testing/development purposes) I should suscribe in order to test your code ?
Thanks in advance,
Luis
 

DonManfred

Expert
Licensed User
Longtime User
Sure, you have to set it up with YOUR own Username/Login from YOUR FTP-Account.
In the test/writing the example) i have used my own FTP-Server-Logincredentials.

You just need a small Webhosting. Mostly you get an ftp-account to access your Webpage with this hosting. Search for ANY Webhosting-Provider and check if they give you ftp-access.

Google is your friend... It will find hostings for free too...

PS: Welcome to B4A community!
 

Luis Alberto Perez

New Member
Licensed User
Longtime User
Thank you Manfred for your reply and welcome.
I am stock....
I used my account in opendrive.com
url: webdav.opendrive.com , gave my user name and password and got the message: Connection refused.
Also I try with this url: www.opendrive.com and got the same message.
I think I should try with another server. Do you know one that works with this ftp protocol so I would open an account to test?

Best regards,

Luis
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…