Search code examples
javaniojava-7

Using WatchService to monitor multiple directories on a mapped Network drive


I would like to use the new Java 7 WatchService to keep tabs on a set of directories specified by the user. On Windows 7 this works fine on the local file system and on mapped network drives for file trees of arbitrary complexity. On Windows XP however, it works fine on local file systems, but when watching folders on a mapped network drive it throws an IOException when trying to watch more than 50 directories:

java.io.IOException: The network BIOS command limit has been reached.

This always happens when trying to call Path.register() on the 51st directory, so it appears to be a hard limit on the number of directories that can be watched. Is there any way I can remove this limit so that it will consistently watch an arbitrary number of directories on both Win 7 and Win XP?


Solution

  • See http://support.microsoft.com/kb/810886 to increase the limit on windows