SMB File Download Problem (bug?)

GuyBooth

Active Member
Licensed User
Longtime User
I am using the smb file download method to download files from a Synology NAS filestation to a Galaxy Tab.

The code is simple enough but I have a problem when the file to be Downloaded does not exist in the source directory: While the DownLoadCompleted code Success parameter is indeed False, the Download method still creates a file entry in the destination folder with a file content of zero bytes. Next time I go to check for missing files in my application, it shows that all the files are there - because the file name has been created, even though the file has nothing in it!

Is this a bug? Surely if it can't copy the file, it should not create the directory entry (or delete it on finding it has failed).
 

GuyBooth

Active Member
Licensed User
Longtime User
Wow - that's unfortunate. Not only does it create a file that shouldn't exist, but I have found it will overwrite a good file with an empty one - so I don't want to wait until an empty file is created and then delete it - I will have to do a file search before I try to copy.
The callback nature of the network operations makes this complicated when mixed with other operations in my code, but it would be easier if I could create more than one smb connection. My NAS server only allows a user to have one connection at a time, so I must "log out" one smb object before I "login" a second one with the same connection details but a different smb object name.

Login is achieved with the smb.credentials method. Is there a way to "logout" an smb connection?

Failing that, how can I destroy an smb object in code?
 
Upvote 0

GuyBooth

Active Member
Licensed User
Longtime User
The connection is made for each operation. There isn't any session. You do not need to destroy the object. The object name doesn't have any effect.
Ah yes, understood - but is it possible to change the callback (event) name without reinitializing the smb object (this is what I was really looking for)?

The solution is very simple. Download the file to a temporary file and then if the operation is successful copy the file to the "real" target.
Yes this IS the simpler solution ...

Thank you.
 
Last edited:
Upvote 0
Top