Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

FileSystemWatcher - Security and network traffic

Our LAN admins are questioning the use of the FileSystemWatcher component from two points of view:

1) How much network traffic will this generate? Does it poll the directory being watched? If so, how often and can the timing be set?

2) What security context will it run under? If it runs under the local SYSTEM account, it won't be able to connect to a remote drive. How do you set the security context to a network account that has the appropriate permissions?

I tried doing a Google search and looking in the docs. Everything shows how to use the component, but not how it does its work.

Please point me to some information on this. Any help is greatly appreciated.

Himanshu Nath
Tuesday, December 30, 2003

1) Shouldn't your admins be able to gauge this for you?
2) I would imagine the security context would just be the security context that the app domain is running in.

Rick Childress
Wednesday, December 31, 2003


1) Yes, they probably could. At this point, we don't have a test network isolated from the main LAN on which we could try this out.

Having an understanding of how the component does its work would help. I'm assuming it checks the directory for changes at a pre-defined interval. If so, I'd like to be able to set that interval, but I can't find any property or method that would do that.

2) Thanks. I should've thought of that.

Himanshu Nath
Wednesday, December 31, 2003

FileSystemWatcher is just a wrapper around the ReadDirectoryChangesW API call. This is the same API that's used when you open an Explorer window on a mapped server drive, and it shows newly added files. This is an event-based API implemented with SMB messages, not a polling API.

Mike Gunderloy
Wednesday, December 31, 2003

Thanks, Mike. I'll do some digging on SMB (Server Message Block) and pass the info on to our LAN admins.

Himanshu Nath
Thursday, January 1, 2004

Excellent call Mike.  I didn't think to check the IL to see exactly what was getting called.

Himanshu, it doesn't sound like it's an issue in your case, but you may want to note that the class isn't supported on Win98.

Rick Childress
Friday, January 2, 2004


Thanks for the heads-up.

We don't use Win98 (everything is Win NT/2K/XP), so that isn't a issue.

Himanshu Nath
Saturday, January 3, 2004

*  Recent Topics

*  Fog Creek Home