FileSystemWatcher Delay
-
I have an application that communicates with the server program through a shared text file, located at a network directory. The server writes to the text file which my application reads. I am using FileSystemWatcher to monitor this file. Now when server writes to the file, change event in my application fires after 2 or 3 seconds. However when I manually change this file and save it, it acts the ideal way. I want to reduce this time delay as this should act like realtime system. My C# code goes like this : ------------------------------------------------------------------- public MyWatcherClass() { watcher = new FileSystemWatcher(); this.watcher.Path = this.MyNetworkDrive; this.watcher.NotifyFilter = NotifyFilters.Size; this.watcher.Filter = this.MyTextFile; this.watcher.Changed += new FileSystemEventHandler(OnChanged); this.watcher.EnableRaisingEvents = true; } ------------------------------------------------------------------- What am I missing? Thanks in advance
-
I have an application that communicates with the server program through a shared text file, located at a network directory. The server writes to the text file which my application reads. I am using FileSystemWatcher to monitor this file. Now when server writes to the file, change event in my application fires after 2 or 3 seconds. However when I manually change this file and save it, it acts the ideal way. I want to reduce this time delay as this should act like realtime system. My C# code goes like this : ------------------------------------------------------------------- public MyWatcherClass() { watcher = new FileSystemWatcher(); this.watcher.Path = this.MyNetworkDrive; this.watcher.NotifyFilter = NotifyFilters.Size; this.watcher.Filter = this.MyTextFile; this.watcher.Changed += new FileSystemEventHandler(OnChanged); this.watcher.EnableRaisingEvents = true; } ------------------------------------------------------------------- What am I missing? Thanks in advance
Call Flush after writing to the file, else it will be buffered. xacc-ide 0.0.10 now with C#, MSIL, C and HLSL coloring - Screenshots
-
Call Flush after writing to the file, else it will be buffered. xacc-ide 0.0.10 now with C#, MSIL, C and HLSL coloring - Screenshots