Missing FTP events

prokli

Active Member
Licensed User
Longtime User
Hello everybody!

Today I downloaded the FtpExample which has been provided by member "vb1992".
The file (located on my FTP Server PC) is successfully downloaded to my android device (great!) but I neither get a "FTP_DownloadCompleted" nor a "FTP_DownloadProgress". First I used debugger and then I put some "Log()" statements into my code. Nothing!
I am just downloading a very small text file.

Thanks for any help
Harald
 

prokli

Active Member
Licensed User
Longtime User
Erel,

actually I get the "FTP_DownloadCompleted" event after file download has finished (I was wrong, don't know why!).
But still I don't get the "FTP_DownloadProgress" event.
Code has been provided by vb1992 member.
 

Attachments

  • FtpExample.zip
    7.3 KB · Views: 243
Upvote 0

prokli

Active Member
Licensed User
Longtime User
Erel,

it's one, very small text file, I am downloading from FTP to my android device.
Neither a brakepoint nor a Log message seem to work. But the file is successfully transferred and I get the "Complete" event.
Anyhow, my app works fine!

But I have another question concerning scheduling FTP Down- and Uploads:
Do I have to wait for "FTP_UploadCompleted" or "FTP_DownloadCompleted" before I can issue another FTP transfer request?
Or, in other words, can I schedule - for example - 20 FTP request whereas I handle the received events in background??

Thx
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is a bit tricky. You can issue multiple requests. A different thread is assigned to each request. The tricky part is that the internal threads pool is limited to 20 threads. So if you issue more than 20 requests at the same time you will get a RejectedExecutionException.

Therefore if you plan to download multiple files it is better to handle them one after another (I believe that this example does it correctly).
 
Upvote 0

prokli

Active Member
Licensed User
Longtime User
Good idea!
I am going to realize it as a state machine: put a FTP request than wait for response......

Thanks!
 
Upvote 0
Top