开发者

FileSystemWatcher Issue

开发者 https://www.devze.com 2023-02-27 07:05 出处:网络
I have a windows service which has a FileSystemWatcher which watch a log folder for txtfiles changes.

I have a windows service which has a FileSystemWatcher which watch a log folder for txtfiles changes.

it fires onChanged Event every time a logline gets written to a txtfile , i start reading for that file and i retrieve that line and then process it som开发者_Python百科e way, the problem is :

the events doesnt get fired unless :

-i open the folder with windows explorer -i keep pressing refresh (f5)

if i dont do that the events doesnt get fired !


Sometimes this might happen when the internal buffer of the file is not flushed. Try flushing the stream after you write to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消