473,482 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

FileSystemWatcher across the network

Hi all,
I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't receive any errors, it is just that FileSystemWatcher doesn't see any files dropped in the folder. What could be wrong?

Thanks
Goran
Sep 14 '06 #1
5 24069
Some basic troubleshooting steps:

1. Make sure the FileSystemWatcher's EnableRaisingEvents property is set to true.
2. Make sure you have not set the FileSystemWatcher's Filter to ignore the type of files being dropped into the folder.
3. Make sure you have set the FileSystemWatcher's NotifyFilter to include to watch for Created files.
--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"Goran Djuranovic" <go**************@newsgroups.nospamwrote in message news:uA**************@TK2MSFTNGP03.phx.gbl...
Hi all,
I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't receive any errors, it is just that FileSystemWatcher doesn't see any files dropped in the folder. What could be wrong?

Thanks
Goran
Sep 14 '06 #2
Hi Mike,
Thanks for your response. Yes, all of those are set correctly.
Using this works fine:
With Me.FolderWatcherObj
.NotifyFilter = (NotifyFilters.FileName Or NotifyFilters.LastWrite Or NotifyFilters.LastAccess Or NotifyFilters.CreationTime Or NotifyFilters.Size)
.Path = "C:\MyFolder"
.Filter = "*.txt"
.IncludeSubdirectories = False
.InternalBufferSize = .InternalBufferSize + 81920
.EnableRaisingEvents = True
End With

Using this doesn't work:
With Me.FolderWatcherObj
.NotifyFilter = (NotifyFilters.FileName Or NotifyFilters.LastWrite Or NotifyFilters.LastAccess Or NotifyFilters.CreationTime Or NotifyFilters.Size)
.Path = \\MyServer\MyFolder <---------- NOTE THE CHANGE
.Filter = "*.txt"
.IncludeSubdirectories = False
.InternalBufferSize = .InternalBufferSize + 81920
.EnableRaisingEvents = True
End With

Goran

"Mike McIntyre" <mi****@getdotnetcode.comwrote in message news:Oc**************@TK2MSFTNGP02.phx.gbl...
Some basic troubleshooting steps:

1. Make sure the FileSystemWatcher's EnableRaisingEvents property is set to true.
2. Make sure you have not set the FileSystemWatcher's Filter to ignore the type of files being dropped into the folder.
3. Make sure you have set the FileSystemWatcher's NotifyFilter to include to watch for Created files.
--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"Goran Djuranovic" <go**************@newsgroups.nospamwrote in message news:uA**************@TK2MSFTNGP03.phx.gbl...
Hi all,
I have a file system watcher service that works fine on a local hard drive, but will not work across the network. I tried both: mapping the drive and "\\..." path both no luck. I don't receive any errors, it is just that FileSystemWatcher doesn't see any files dropped in the folder. What could be wrong?

Thanks
Goran
Sep 14 '06 #3
Hi Goran,

I'm sorry that the documentation of FileSystemWatcher.InternalBufferSize
didn't state very clear about the buffer size when monitoring network path.
It's recommended not exceeds 64K when monitoring network path.

FileSystemWatcher is basically a .Net wrapper for the Win32
ReadDirectoryChangesW API. To use ReadDirectoryChangesW, you create and
specify a buffer that the OS will populate with the changes. However, what
is not mentioned in the ReadDirectoryChangesW documentation (but is hinted
in the FileSystemWatcher docs) is that the file system creates an internal
kernel buffer to store the change information temporarily until it has the
chance to update the user buffer. The size of the kernel buffer that is
created is the same size that is specified in ReadDirectoryChangesW and is
created in non-paged pooled memory. Every time a FileSystemWatcher /
ReadDirectoryChangesW is created / called, a new kernel buffer is also
created.

The kernel memory pools (paged and non-paged) are set aside in the system
address space for device drivers and other kernel components to use. They
grow and shrink dynamically as necessary. The current size of the pools
can be easily seen by going to the Performance tab of the Task Manager.
The pools will grow dynamically until they hit a maximum value which is
calculated at boot time and depends on available system resources (mostly
RAM). You do not want to hit this maximum value or else various system
services and drivers will start failing. However, this calculated maximum
value is not easily available. To determine the maximum pool sizes, you
need to use a kernel debugger. If you are interested in further
information about the system memory pools, I recommend that you look at
Chapter 7 in the MSPress book Inside Windows 2000 by Solomon and
Russinovich.

With this in mind, there is no recommendation on what size buffers you can
use. The current and maximum size of the system pools are going to be
varied from client to client. However, you probably should not go over 64k
for each FileSystemWatcher / ReadDirectoryChangesW buffer. This stems from
the fact that there is a 64k limitation with network access as documented
in ReadDirectoryChangesW. But in the end you are going to have to test the
application on a variety of expected target systems so that you can tune
your buffer.

There is overhead associated with .Net applications and I imagine that a
Win32 ReadDirectoryChangesW program might be able to achieve better
performance with the same buffer size. However, with very fast and
numerous file changes, buffer overruns will be inevitable and the developer
is going to have to handle the case when an overrun occurs such as manually
enumerating the directory to detect the changes.

In conclusion, FileSystemWatcher and ReadDirectoryChangesW are a
lightweight file change detection mechanism that is going to have its
limitations. Change Journals is another mechanism which we would consider
a medium-weight solution, but would still have limitations:

http://msdn.microsoft.com/library/en...e_journals.asp

Heavy-weight solutions would be to write a dedicated file system filter
driver that sits in the file system stack and monitors file system changes.
Of course this would be the most complex approach. Most virus scanners,
backup software, and file system monitoring utilities such as filemon
(www.sysinternals.com) implement a filter driver.

I hope above explanation helps you to understand the root cause of the
issue you're experiencing. Please reply to let us know whether or not you
need further information. Thank you.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 15 '06 #4
What Server OS is the target filesystem on? As far as I know, only Win95,
98, ME, XP, 2000, and 2003 support the FSW interface. NT 4 and earlier and
no version of Samba that I'm aware of support FSW.

Mike Ober.

"Goran Djuranovic" <go**************@newsgroups.nospamwrote in message
news:uA**************@TK2MSFTNGP03.phx.gbl...
Hi all,
I have a file system watcher service that works fine on a local hard drive,
but will not work across the network. I tried both: mapping the drive and
"\\..." path both no luck. I don't receive any errors, it is just that
FileSystemWatcher doesn't see any files dropped in the folder. What could be
wrong?

Thanks
Goran

Sep 15 '06 #5
Walter,
You were right on the target. Nothing else was wrong, but the
InternalBufferSize. When I decreased it to 50K (51200B) worked like a charm.
It would not work above that size for that specific network connection.

Thanks a lot everyone
Goran Djuranovic
"Walter Wang [MSFT]" <wa****@online.microsoft.comwrote in message
news:5f**************@TK2MSFTNGXA01.phx.gbl...
Hi Goran,

I'm sorry that the documentation of FileSystemWatcher.InternalBufferSize
didn't state very clear about the buffer size when monitoring network
path.
It's recommended not exceeds 64K when monitoring network path.

FileSystemWatcher is basically a .Net wrapper for the Win32
ReadDirectoryChangesW API. To use ReadDirectoryChangesW, you create and
specify a buffer that the OS will populate with the changes. However,
what
is not mentioned in the ReadDirectoryChangesW documentation (but is hinted
in the FileSystemWatcher docs) is that the file system creates an internal
kernel buffer to store the change information temporarily until it has the
chance to update the user buffer. The size of the kernel buffer that is
created is the same size that is specified in ReadDirectoryChangesW and is
created in non-paged pooled memory. Every time a FileSystemWatcher /
ReadDirectoryChangesW is created / called, a new kernel buffer is also
created.

The kernel memory pools (paged and non-paged) are set aside in the system
address space for device drivers and other kernel components to use. They
grow and shrink dynamically as necessary. The current size of the pools
can be easily seen by going to the Performance tab of the Task Manager.
The pools will grow dynamically until they hit a maximum value which is
calculated at boot time and depends on available system resources (mostly
RAM). You do not want to hit this maximum value or else various system
services and drivers will start failing. However, this calculated maximum
value is not easily available. To determine the maximum pool sizes, you
need to use a kernel debugger. If you are interested in further
information about the system memory pools, I recommend that you look at
Chapter 7 in the MSPress book Inside Windows 2000 by Solomon and
Russinovich.

With this in mind, there is no recommendation on what size buffers you can
use. The current and maximum size of the system pools are going to be
varied from client to client. However, you probably should not go over
64k
for each FileSystemWatcher / ReadDirectoryChangesW buffer. This stems
from
the fact that there is a 64k limitation with network access as documented
in ReadDirectoryChangesW. But in the end you are going to have to test
the
application on a variety of expected target systems so that you can tune
your buffer.

There is overhead associated with .Net applications and I imagine that a
Win32 ReadDirectoryChangesW program might be able to achieve better
performance with the same buffer size. However, with very fast and
numerous file changes, buffer overruns will be inevitable and the
developer
is going to have to handle the case when an overrun occurs such as
manually
enumerating the directory to detect the changes.

In conclusion, FileSystemWatcher and ReadDirectoryChangesW are a
lightweight file change detection mechanism that is going to have its
limitations. Change Journals is another mechanism which we would consider
a medium-weight solution, but would still have limitations:

http://msdn.microsoft.com/library/en...e_journals.asp

Heavy-weight solutions would be to write a dedicated file system filter
driver that sits in the file system stack and monitors file system
changes.
Of course this would be the most complex approach. Most virus scanners,
backup software, and file system monitoring utilities such as filemon
(www.sysinternals.com) implement a filter driver.

I hope above explanation helps you to understand the root cause of the
issue you're experiencing. Please reply to let us know whether or not you
need further information. Thank you.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your
reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Sep 15 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2331
by: Jon | last post by:
Hi, in my program, i want to send a signal to other computer on the network (LAN). so that when other recieves this signal, it will do something... What Class should I use for sending the...
3
1957
by: Parag Gaikwad | last post by:
Hi, I need to delete files across the network using web client (IE 6.x) in Win 2003 - IIS 6.0 environment. Can someone please suggest an approach I can use to acheive this. Will using FSO do...
4
3117
by: Sue | last post by:
Hello We have an application where the user would upload files (max size of 200 mb) from their client machine. This application will run on a web server (its a web server which would be used by...
1
1421
by: AbeR | last post by:
I'm not sure that this the right forum, but here it goes. I wrote my first real win app in C# VS2003 and it ran famously on the dev machine and on the client machine. Copying the same exe onto a...
0
1127
by: Pete | last post by:
I have a web asp.net 1.1 app that is using Windows Authentication on an Apache server. I cannot connect across the Intranet to another network even though there is a 'TRUST' setup between the...
3
16970
by: =?Utf-8?B?U2Vhbk1hYw==?= | last post by:
How do I programmatically copy files across a network (from a local workstation to another local workstation on the network) using visual basic 2005? In other words, when in explorer and you enter...
4
16062
by: Prof. William Battersea | last post by:
Hello, Suppose I have a Vista machine called VISTA and an XP machine called XP in a workgroup named WORKGROUP. Physically they're connected to a router and I can see lists of public and shared...
1
1791
by: prakashwadhwani | last post by:
I have an app containing 9 forms which have approximately 2 to 3 combo boxes and 7 to 8 text boxes + a few labels (in each form). On the same PC the forms open very fast. However when I load the...
2
1857
by: KingKen | last post by:
what command do you use to send messages across a network from the command line interface? Also how do you use it?
0
7071
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6927
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6781
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4810
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3025
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1326
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
580
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
222
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.