dmka
1 Beitrag
schrieb am 13.02.19 um 12:06 Uhrzuletzt bearbeitet von dmka am 13.02.19 um 12:37 Uhr
Link zu diesem 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, 29 mal heruntergeladen)
 
alex
2353 Beiträge
schrieb am 13.03.19 um 17:08 Uhr
Link zu diesem 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