Event Handling Problem 
Author Message
 Event Handling Problem

Hello,
 I am adding an event handler in my application as follows:

Dim fsw as new FileSystemWatcher()
AddHandler fsw.Created, AddressOf(OnBulkFileCreated)

Private Sub OnBulkFileCreated(ByVal source As Object, ByVal e As
System.IO.FileSystemEventArgs)
....
End Sub

The event would be raised anytime a new file is created. The Problem is that
files are created at the rate of 100/minute in the application, so
theorotically 100 events should be raised. But that is NOT happening. Can
somebody tell what the problem is?

Thanks,
Rajesh



Fri, 28 Jan 2005 22:45:28 GMT  
 Event Handling Problem
What is happening?  Are some events being raised, others not?

--
Robert Chapman
Manager, Applications Development
prairieFyre Software Inc.
http://www.prairiefyre.com

Quote:
> Hello,
>  I am adding an event handler in my application as follows:

> Dim fsw as new FileSystemWatcher()
> AddHandler fsw.Created, AddressOf(OnBulkFileCreated)

> Private Sub OnBulkFileCreated(ByVal source As Object, ByVal e As
> System.IO.FileSystemEventArgs)
> ....
> End Sub

> The event would be raised anytime a new file is created. The Problem is
that
> files are created at the rate of 100/minute in the application, so
> theorotically 100 events should be raised. But that is NOT happening. Can
> somebody tell what the problem is?

> Thanks,
> Rajesh



Fri, 28 Jan 2005 23:07:58 GMT  
 Event Handling Problem
The Problem is like this :

I am using FileSystemWatcher class in my VB.NET code and it watches a
directory to see if any new files are created. If a new file is created in
the directory, it calls a function. The code looks like as shown below :

    Dim watcher as new FileSystemWatcher()

    Watcher.Filter = "*.txt"
    Watcher.Path = "C:\Try"
    Watcher.NotifyFilter = IO.NotifyFilters.FileName

    AddHandler watcher.created, AddressOf OnBulkFileCreated
    ....
    ....

Sub OnBulkFileCreated(ByVal source As Object, ByVal e as
System.IO.FileSystemEventArgs)
...
...
End Sub

There is a separate file creation process which creates around 100 files in
a minute, and the filesystem watcher is unable to keep the pace with the
other process. That is ok, coz OnBulkFileCreated function
above invokes a bulk insert operation on SQL Server. But the watcher DOES
NOT raises event for all the files. I think that the watcher is unable to
handle so many file creation events pumped to him by the operating system.
Maybe I am wrong. I created 1000 files, and expect 1000 events to be raised,
but only 600 something events got raised! It tested it multiple times but to
no avail. My PC configuration is Windows XP, P3 698 MHz, 384MB RAM

One thing which I noticed is that on my windows 2000 server, dual processor,
1.2 GHz, 1024 MB RAM, all the events were raised!


Quote:
> What is happening?  Are some events being raised, others not?

> --
> Robert Chapman
> Manager, Applications Development
> prairieFyre Software Inc.
> http://www.prairiefyre.com


> > Hello,
> >  I am adding an event handler in my application as follows:

> > Dim fsw as new FileSystemWatcher()
> > AddHandler fsw.Created, AddressOf(OnBulkFileCreated)

> > Private Sub OnBulkFileCreated(ByVal source As Object, ByVal e As
> > System.IO.FileSystemEventArgs)
> > ....
> > End Sub

> > The event would be raised anytime a new file is created. The Problem is
> that
> > files are created at the rate of 100/minute in the application, so
> > theorotically 100 events should be raised. But that is NOT happening.
Can
> > somebody tell what the problem is?

> > Thanks,
> > Rajesh



Fri, 28 Jan 2005 23:34:54 GMT  
 Event Handling Problem
That's interesting, sounds like a bug.  Have you searched the news groups
for similar stories?

http://groups.google.com/advanced_group_search

--
Robert Chapman
Manager, Applications Development
prairieFyre Software Inc.
http://www.prairiefyre.com

Quote:
> The Problem is like this :

> I am using FileSystemWatcher class in my VB.NET code and it watches a
> directory to see if any new files are created. If a new file is created in
> the directory, it calls a function. The code looks like as shown below :

>     Dim watcher as new FileSystemWatcher()

>     Watcher.Filter = "*.txt"
>     Watcher.Path = "C:\Try"
>     Watcher.NotifyFilter = IO.NotifyFilters.FileName

>     AddHandler watcher.created, AddressOf OnBulkFileCreated
>     ....
>     ....

> Sub OnBulkFileCreated(ByVal source As Object, ByVal e as
> System.IO.FileSystemEventArgs)
> ...
> ...
> End Sub

> There is a separate file creation process which creates around 100 files
in
> a minute, and the filesystem watcher is unable to keep the pace with the
> other process. That is ok, coz OnBulkFileCreated function
> above invokes a bulk insert operation on SQL Server. But the watcher DOES
> NOT raises event for all the files. I think that the watcher is unable to
> handle so many file creation events pumped to him by the operating system.
> Maybe I am wrong. I created 1000 files, and expect 1000 events to be
raised,
> but only 600 something events got raised! It tested it multiple times but
to
> no avail. My PC configuration is Windows XP, P3 698 MHz, 384MB RAM

> One thing which I noticed is that on my windows 2000 server, dual
processor,
> 1.2 GHz, 1024 MB RAM, all the events were raised!



> > What is happening?  Are some events being raised, others not?

> > --
> > Robert Chapman
> > Manager, Applications Development
> > prairieFyre Software Inc.
> > http://www.prairiefyre.com


> > > Hello,
> > >  I am adding an event handler in my application as follows:

> > > Dim fsw as new FileSystemWatcher()
> > > AddHandler fsw.Created, AddressOf(OnBulkFileCreated)

> > > Private Sub OnBulkFileCreated(ByVal source As Object, ByVal e As
> > > System.IO.FileSystemEventArgs)
> > > ....
> > > End Sub

> > > The event would be raised anytime a new file is created. The Problem
is
> > that
> > > files are created at the rate of 100/minute in the application, so
> > > theorotically 100 events should be raised. But that is NOT happening.
> Can
> > > somebody tell what the problem is?

> > > Thanks,
> > > Rajesh



Sat, 29 Jan 2005 00:18:41 GMT  
 Event Handling Problem
Hi Rajesh,

MS help says when using the FileSystemWatcher there is a buffer that holds
the file changes and when there are many in a short time, the buffer can
overflow and therefore you lose events.  You can extend the buffer but this
is not recommend.

Perhaps you need to take a different approach, for example polling the
directory at short intervals

Tom


Quote:
> The Problem is like this :

> I am using FileSystemWatcher class in my VB.NET code and it watches a
> directory to see if any new files are created. If a new file is created in
> the directory, it calls a function. The code looks like as shown below :

>     Dim watcher as new FileSystemWatcher()

>     Watcher.Filter = "*.txt"
>     Watcher.Path = "C:\Try"
>     Watcher.NotifyFilter = IO.NotifyFilters.FileName

>     AddHandler watcher.created, AddressOf OnBulkFileCreated
>     ....
>     ....

> Sub OnBulkFileCreated(ByVal source As Object, ByVal e as
> System.IO.FileSystemEventArgs)
> ...
> ...
> End Sub

> There is a separate file creation process which creates around 100 files
in
> a minute, and the filesystem watcher is unable to keep the pace with the
> other process. That is ok, coz OnBulkFileCreated function
> above invokes a bulk insert operation on SQL Server. But the watcher DOES
> NOT raises event for all the files. I think that the watcher is unable to
> handle so many file creation events pumped to him by the operating system.
> Maybe I am wrong. I created 1000 files, and expect 1000 events to be
raised,
> but only 600 something events got raised! It tested it multiple times but
to
> no avail. My PC configuration is Windows XP, P3 698 MHz, 384MB RAM

> One thing which I noticed is that on my windows 2000 server, dual
processor,
> 1.2 GHz, 1024 MB RAM, all the events were raised!



> > What is happening?  Are some events being raised, others not?

> > --
> > Robert Chapman
> > Manager, Applications Development
> > prairieFyre Software Inc.
> > http://www.prairiefyre.com


> > > Hello,
> > >  I am adding an event handler in my application as follows:

> > > Dim fsw as new FileSystemWatcher()
> > > AddHandler fsw.Created, AddressOf(OnBulkFileCreated)

> > > Private Sub OnBulkFileCreated(ByVal source As Object, ByVal e As
> > > System.IO.FileSystemEventArgs)
> > > ....
> > > End Sub

> > > The event would be raised anytime a new file is created. The Problem
is
> > that
> > > files are created at the rate of 100/minute in the application, so
> > > theorotically 100 events should be raised. But that is NOT happening.
> Can
> > > somebody tell what the problem is?

> > > Thanks,
> > > Rajesh



Sat, 29 Jan 2005 00:57:42 GMT  
 Event Handling Problem
I haven't found anything in news groups yet.


Quote:
> That's interesting, sounds like a bug.  Have you searched the news groups
> for similar stories?

> http://groups.google.com/advanced_group_search

> --
> Robert Chapman
> Manager, Applications Development
> prairieFyre Software Inc.
> http://www.prairiefyre.com


> > The Problem is like this :

> > I am using FileSystemWatcher class in my VB.NET code and it watches a
> > directory to see if any new files are created. If a new file is created
in
> > the directory, it calls a function. The code looks like as shown below :

> >     Dim watcher as new FileSystemWatcher()

> >     Watcher.Filter = "*.txt"
> >     Watcher.Path = "C:\Try"
> >     Watcher.NotifyFilter = IO.NotifyFilters.FileName

> >     AddHandler watcher.created, AddressOf OnBulkFileCreated
> >     ....
> >     ....

> > Sub OnBulkFileCreated(ByVal source As Object, ByVal e as
> > System.IO.FileSystemEventArgs)
> > ...
> > ...
> > End Sub

> > There is a separate file creation process which creates around 100 files
> in
> > a minute, and the filesystem watcher is unable to keep the pace with the
> > other process. That is ok, coz OnBulkFileCreated function
> > above invokes a bulk insert operation on SQL Server. But the watcher
DOES
> > NOT raises event for all the files. I think that the watcher is unable
to
> > handle so many file creation events pumped to him by the operating
system.
> > Maybe I am wrong. I created 1000 files, and expect 1000 events to be
> raised,
> > but only 600 something events got raised! It tested it multiple times
but
> to
> > no avail. My PC configuration is Windows XP, P3 698 MHz, 384MB RAM

> > One thing which I noticed is that on my windows 2000 server, dual
> processor,
> > 1.2 GHz, 1024 MB RAM, all the events were raised!



> > > What is happening?  Are some events being raised, others not?

> > > --
> > > Robert Chapman
> > > Manager, Applications Development
> > > prairieFyre Software Inc.
> > > http://www.prairiefyre.com


> > > > Hello,
> > > >  I am adding an event handler in my application as follows:

> > > > Dim fsw as new FileSystemWatcher()
> > > > AddHandler fsw.Created, AddressOf(OnBulkFileCreated)

> > > > Private Sub OnBulkFileCreated(ByVal source As Object, ByVal e As
> > > > System.IO.FileSystemEventArgs)
> > > > ....
> > > > End Sub

> > > > The event would be raised anytime a new file is created. The Problem
> is
> > > that
> > > > files are created at the rate of 100/minute in the application, so
> > > > theorotically 100 events should be raised. But that is NOT
happening.
> > Can
> > > > somebody tell what the problem is?

> > > > Thanks,
> > > > Rajesh



Sat, 29 Jan 2005 01:07:08 GMT  
 Event Handling Problem
Tom, yeah I eventually am using polling mechanism. But I am wondering, if
the buffer overflows, why does it work perfectly on my Windows 2000 Server!!


Quote:
> Hi Rajesh,

> MS help says when using the FileSystemWatcher there is a buffer that holds
> the file changes and when there are many in a short time, the buffer can
> overflow and therefore you lose events.  You can extend the buffer but
this
> is not recommend.

> Perhaps you need to take a different approach, for example polling the
> directory at short intervals

> Tom



> > The Problem is like this :

> > I am using FileSystemWatcher class in my VB.NET code and it watches a
> > directory to see if any new files are created. If a new file is created
in
> > the directory, it calls a function. The code looks like as shown below :

> >     Dim watcher as new FileSystemWatcher()

> >     Watcher.Filter = "*.txt"
> >     Watcher.Path = "C:\Try"
> >     Watcher.NotifyFilter = IO.NotifyFilters.FileName

> >     AddHandler watcher.created, AddressOf OnBulkFileCreated
> >     ....
> >     ....

> > Sub OnBulkFileCreated(ByVal source As Object, ByVal e as
> > System.IO.FileSystemEventArgs)
> > ...
> > ...
> > End Sub

> > There is a separate file creation process which creates around 100 files
> in
> > a minute, and the filesystem watcher is unable to keep the pace with the
> > other process. That is ok, coz OnBulkFileCreated function
> > above invokes a bulk insert operation on SQL Server. But the watcher
DOES
> > NOT raises event for all the files. I think that the watcher is unable
to
> > handle so many file creation events pumped to him by the operating
system.
> > Maybe I am wrong. I created 1000 files, and expect 1000 events to be
> raised,
> > but only 600 something events got raised! It tested it multiple times
but
> to
> > no avail. My PC configuration is Windows XP, P3 698 MHz, 384MB RAM

> > One thing which I noticed is that on my windows 2000 server, dual
> processor,
> > 1.2 GHz, 1024 MB RAM, all the events were raised!



> > > What is happening?  Are some events being raised, others not?

> > > --
> > > Robert Chapman
> > > Manager, Applications Development
> > > prairieFyre Software Inc.
> > > http://www.prairiefyre.com


> > > > Hello,
> > > >  I am adding an event handler in my application as follows:

> > > > Dim fsw as new FileSystemWatcher()
> > > > AddHandler fsw.Created, AddressOf(OnBulkFileCreated)

> > > > Private Sub OnBulkFileCreated(ByVal source As Object, ByVal e As
> > > > System.IO.FileSystemEventArgs)
> > > > ....
> > > > End Sub

> > > > The event would be raised anytime a new file is created. The Problem
> is
> > > that
> > > > files are created at the rate of 100/minute in the application, so
> > > > theorotically 100 events should be raised. But that is NOT
happening.
> > Can
> > > > somebody tell what the problem is?

> > > > Thanks,
> > > > Rajesh



Sat, 29 Jan 2005 01:08:45 GMT  
 Event Handling Problem
Maybe the size of the buffer depends on the total amount
of memory in your machine. Maybe it is a percent of the
total available to the application? I don't know if this
is true but that would explain why it runs on your server
which has more memory....

Quote:
>-----Original Message-----
>Tom, yeah I eventually am using polling mechanism. But I
am wondering, if
>the buffer overflows, why does it work perfectly on my

Windows 2000 Server!!
Quote:



>> Hi Rajesh,

>> MS help says when using the FileSystemWatcher there is
a buffer that holds
>> the file changes and when there are many in a short

time, the buffer can
Quote:
>> overflow and therefore you lose events.  You can extend
the buffer but
>this
>> is not recommend.

>> Perhaps you need to take a different approach, for
example polling the
>> directory at short intervals

>> Tom


message

>> > The Problem is like this :

>> > I am using FileSystemWatcher class in my VB.NET code
and it watches a
>> > directory to see if any new files are created. If a
new file is created
>in
>> > the directory, it calls a function. The code looks

like as shown below :

- Show quoted text -

Quote:

>> >     Dim watcher as new FileSystemWatcher()

>> >     Watcher.Filter = "*.txt"
>> >     Watcher.Path = "C:\Try"
>> >     Watcher.NotifyFilter = IO.NotifyFilters.FileName

>> >     AddHandler watcher.created, AddressOf
OnBulkFileCreated
>> >     ....
>> >     ....

>> > Sub OnBulkFileCreated(ByVal source As Object, ByVal e
as
>> > System.IO.FileSystemEventArgs)
>> > ...
>> > ...
>> > End Sub

>> > There is a separate file creation process which

creates around 100 files
Quote:
>> in
>> > a minute, and the filesystem watcher is unable to

keep the pace with the

- Show quoted text -

Quote:
>> > other process. That is ok, coz OnBulkFileCreated
function
>> > above invokes a bulk insert operation on SQL Server.
But the watcher
>DOES
>> > NOT raises event for all the files. I think that the
watcher is unable
>to
>> > handle so many file creation events pumped to him by
the operating
>system.
>> > Maybe I am wrong. I created 1000 files, and expect
1000 events to be
>> raised,
>> > but only 600 something events got raised! It tested
it multiple times
>but
>> to
>> > no avail. My PC configuration is Windows XP, P3 698
MHz, 384MB RAM

>> > One thing which I noticed is that on my windows 2000
server, dual
>> processor,
>> > 1.2 GHz, 1024 MB RAM, all the events were raised!


message

>> > > What is happening?  Are some events being raised,
others not?

>> > > --
>> > > Robert Chapman
>> > > Manager, Applications Development
>> > > prairieFyre Software Inc.
>> > > http://www.prairiefyre.com

message

>> > > > Hello,
>> > > >  I am adding an event handler in my application
as follows:

>> > > > Dim fsw as new FileSystemWatcher()
>> > > > AddHandler fsw.Created, AddressOf
(OnBulkFileCreated)

>> > > > Private Sub OnBulkFileCreated(ByVal source As
Object, ByVal e As
>> > > > System.IO.FileSystemEventArgs)
>> > > > ....
>> > > > End Sub

>> > > > The event would be raised anytime a new file is

created. The Problem

- Show quoted text -

Quote:
>> is
>> > > that
>> > > > files are created at the rate of 100/minute in
the application, so
>> > > > theorotically 100 events should be raised. But
that is NOT
>happening.
>> > Can
>> > > > somebody tell what the problem is?

>> > > > Thanks,
>> > > > Rajesh

>.



Sat, 29 Jan 2005 22:55:01 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. -~=###--WHAT IS THE DIFFERENCE BETWEEN HANDLED EVENTS AND UN-HANDLED EVENTS?---#=~-

2. ActiveX control to handle mouseover event handling?

3. VB4 problem: DBCombo does not handle mouse events

4. problem w/class handling events of form instances..

5. Problem handling events coming from ActiveX EXE

6. A single event handling multiple events

7. handling multiple events with one event handler

8. handling multiple events with a single event handler

9. Control Event Problem (Post Event after an event is fired)

10. newMail event handling in C#

11. How to handle shortcut key events in MS Outlook 2002

12. Handling CommandButton Click Events in Class Module

 

 
Powered by phpBB® Forum Software