Help: FileSystemWatcher weird problem!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cxw0106

    #1

    Help: FileSystemWatcher weird problem!

    Hello,

    I have some weird problem with the FileSystemWatch er. I have developed
    an application that monitors a network directory for file changes of a
    certain file type. The program runs well for a week. Then suddenly the
    monitored network server starts to behave crazily. It sends to my Sync
    Server dozens of replicated file change events. Say one file was
    changed two days ago, but the monitored server still keeps sending me
    many many events of that file. It sends me 9000 events in a minutes
    and keeps sending me so many events hour by hour. This drives me
    crazy!! Our network server is a Windows 2000 Server. It's a important
    server that many people here need to access it and modify files on the
    monitored directory.

    Why that network server keeps sending me false 'file change' event? Is
    that some kind of worm? What windows service does FileSystemWatch er
    events rely on? I have check the event log, but it doesn't help much.
    Please help! THANKS.

    Here is some code in my application. I don't think my code have some
    problem, because the server can run for serveral days without any
    problem. The problem is my sync server got toooo many false events!!

    --------------------------
    watcher.Path = srcdir; // monitored network directory
    watcher.Filter= filetype; //certain file type such as"*.doc"
    watcher.Include Subdirectories = true;
    watcher.NotifyF ilter =
    NotifyFilters.F ileName|NotifyF ilters.LastWrit e|NotifyFilters .DirectoryName| NotifyFilters.S ize;
    watcher.Interna lBufferSize=819 2*8;

    // Setup event handlers
    watcher.Changed += new FileSystemEvent Handler(OnChang ed);
    watcher.Created += new FileSystemEvent Handler(OnChang ed);
    watcher.Deleted += new FileSystemEvent Handler(OnDelet ed);
    watcher.Renamed += new RenamedEventHan dler(OnRenamed) ;
    watcher.Error += new ErrorEventHandl er(OnError);

    // Enable the FileSystemWatch er to notify events
    watcher.EnableR aisingEvents = true;
Working...