|
|
|
start date: Wed, 15 Aug 2007 02:18:03 -0700,
posted on: microsoft.public.dotnet.framework
back
| Thread Index |
|
1
Jonte
|
|
2
UL-Tomten
|
|
3
Michael D. Ober obermd.@.alum.mit.edu.nospam
|
FileSystemWatcher-Loosing events?
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
Date:Wed, 15 Aug 2007 02:18:03 -0700
Author:
|
Re: FileSystemWatcher-Loosing events?
On Aug 15, 11:18 am, Jonte wrote:
> 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?
Date:Wed, 15 Aug 2007 02:52:55 -0700
Author:
|
Re: FileSystemWatcher-Loosing events?
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.
"UL-Tomten" wrote in message
news:1187171575.755041.150800@19g2000hsx.googlegroups.com...
>
> On Aug 15, 11:18 am, Jonte wrote:
>
>> 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?
>
Date:Wed, 15 Aug 2007 11:55:19 -0600
Author:
|
|
|