dmka
1 Post
wrote on 13.02.19 at 13:06 last edited by dmka on 13.02.19 at 13:37
Link to this post
Hallo,

I am capturing streams from a Windows VM and write them to network share (NAS). The streamWriter is set to overwrite the smaller files with bigger ones. However, when streamWriter is unable to write the new file (network error?) it still deletes the old one and leaves a zero-length file (see the screenshot attached).



My proposal:

Do the file replacement more "transactional". Rename the old file to file+.tmp, write the new one, delete .tmp if write was successful, undo otherwise.

I would also appreciate having an option to write stream files to a separate directory, e.g. write to a local storage and move to a network share when the track is fully recorded.

P.S. BTW I don’t know why the noted above network error happens – the network connection to NAS is 1Gb and is very reliable and I don’t experience any problems like this with other apps. However, the tracks from this station are much bigger (100-200MB per file) than usual.

Best regards,
dmka
CouldNotSave.png (130.6 KB, 967 times downloaded)
 
alex
2549 Posts
wrote on 13.03.19 at 18:08
Link to this post
My proposal:

Do the file replacement more "transactional". Rename the old file to file+.tmp, write the new one, delete .tmp if write was successful, undo otherwise.

This would be quite a hack - what if the rename operation does not work?
LG/Best regards, Alex

"Journalism is printing what someone else does not want printed. Everything else is public relations."
- George Orwell

D1734FA178BF7D5AE50CB1AD54442494