Android Question Send and receive files via SMB

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I'm having a lot of trouble trying to get what I need.
The process is as follows:
- From an android device I send SMB files to a computer (windows/linux).
The files have the name yyyyymmddhhmmssSSS.qry
(20170830213615255.qry)
- The Windows/linux computer processes these files and responds by creating the response in files that
have the same name, but ending in .res (yyyyymmddhhmmssSSS.res)
The response time (creating the file and leaving it in the shared directory) is about tenths of a second, though sometimes
may take several seconds.

The android device has to be checking that the response files are present, in order to download and process them.

I'm doing it through SMB, to upload them there's no problem:
B4X:
SMB1.UploadFile(cDirExchange, cNameFileQry, cPathSMB, cNameFileQry)

Then I don't know how to get android to wait for the response file to be
available on the SMB machine for downloading and processing.

I don't know if you can give me any examples, ideas or tricks on how to get it.
Add the files to a list and process them from there?

Thank you for your help.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
SMB1.UploadFile(...)
Dim MaxRetries As Int = 5
For i = 1 to MaxRetries
 Sleep(1000)
 SMB1.DownloadFile(...)
 Wait For SMB1_DownloadComplete (Url As String, RemoteFile As String, Success As Boolean)
 If Success Then
   '
   Exit
 End If
Next
If i > MaxRetries Then
 Log("Failed to download")
End If
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thank you very much, that works well.

Although I will surely have to ask later, because my case is very tangled..
Greetings.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hello again, I want to say that it works perfectly.
I used not know its existence "wait for". It's very useful.
Thank you very much.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I do not know how I could live until now without the "Wait For".
From which version does it exist?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
7.0
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hello, that question has nothing to do with this thread, they will surely answer you that you create a new thread with your question.
Anyway, what you want you can easily do by listing the files you want to download, and then downloading them in a loop, for example.
 
Upvote 0
Top