FileSystemWatcher-Loosing events?

G

Guest

I am using fileSystemWatcher to monitor a directory on a file server. I am
looking for zip files. When a zip file arrives the watcher event is trigged
an I can unzip the file and then delete it. A very simple application but...I
have a problem. When I copy say 10 zip files at once into the watched
directory a problem occure. What I can se som create events are missed? Is
there a max buffer limit. No error is created by fileSystemWatcher. I used
this watcher instead of a timer to win some unwanted processing time
(polling).

Is there a solution for this I want to know it :)

//Jonte
 
U

UL-Tomten

I am using fileSystemWatcher to monitor a directory on a file server.

A remote server?

Could you show some code?

When you read the MSDN FileSystemWatcher documentation, you saw that
there is an internal buffer that can silently overflow. The usual
method for keeping this from happening is increasing the buffer size,
watching for less changes. Could you try that and see if it makes any
difference?
 
M

Michael D. Ober

I have the same problem, regardless of buffer size. There is an event for
the buffer overflow and I never receive it even though I still miss and
occasional FSW event.

The issue is that the underlying API follows the following logic:

Set FSW and wait for event
On event, handle the event
Set FSW and wait for event.

It appears that the event handler in .NET occurs before the FSW is set for
the next event, so if you have a long event handler, you will indeed lose
events.

Mike Ober.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top