Author Topic: VB.NET - FileSystemWatcher Will Not Watch Novell Server Folder  (Read 3268 times)

0 Members and 1 Guest are viewing this topic.

Bill Tillman

  • Guest
VB.NET - FileSystemWatcher Will Not Watch Novell Server Folder
« on: October 23, 2012, 08:10:17 AM »
I have a real dilema here. A simple FileSystemWatcher snippet that will work as long as I'm watching the local C: drive at my office but it will not work when I'm trying to monitor folders on the Novell servers in this corporate LAN. So I tested the same code on my LAN at home which is BSD server running Samba. The Windows clients in my home LAN see the BSD server as though it were a Windows server and I have drives mapped, etc... On my home LAN the code works perfectly in that I can monitor a folder on the server whether I call it by it's mapped drive name or UNC format. So the code appears to be solid. But here at this office no matter which way I try it the FileSystemWatcher program just sits there looking dumb when I add a new file to the folder on the server being monitored. The IT guys here are not much help and have told me it should work.

Here is the VB.NET code snippet. It runs with a small form which has three buttons and a multi-line textbox. I have found that FileSystemWatcher seems to only function fully once you have compiled and run the exe. Just starting Debug will get work but when a file is added to the monitored folder the debugging process just stops. At least I can confirm that something did happen and when I run the exe file I can see that the code works as planned.

Code: [Select]
Imports System.IO
Imports System.Diagnostics

Public Class Form1

    Public watcher As New FileSystemWatcher

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

        watcher.NotifyFilter = (NotifyFilters.FileName)

        ' Only watch text files.
        watcher.Filter = "*.txt"
       ' Try with UNC format and drive mapping
       ' watcher.Path = "\\a_very_long_novell_unc_path\My_Folder"
        watcher.Path = "I:\My_Folder"

        AddHandler watcher.Created, AddressOf OnChanged
       
        ' Begin watching the folder
        watcher.EnableRaisingEvents = True
        btnStop.Enabled = True
        btnStart.Enabled = False
        txtDwgLog.Text = txtDwgLog.Text & "Monitoring started at " & (Now.ToString("f")) & vbCrLf
    End Sub

    Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)
        txtDwgLog.Text = txtDwgLog.Text & (e.FullPath) & " added to folder." & vbCrLf

    End Sub

    Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
        watcher.EnableRaisingEvents = False
        btnStop.Enabled = False
        btnStart.Enabled = True
        txtDwgLog.Text = txtDwgLog.Text & "Monitoring stopped at " & (Now.ToString("f")) & vbCrLf
    End Sub

End Class

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: VB.NET - FileSystemWatcher Will Not Watch Novell Server Folder
« Reply #1 on: October 23, 2012, 08:27:39 AM »
Perhaps the Novell server is expecting different permissions than what you are providing.

I'd start by checking the permissions of the drive being monitored, the permissions of the user where the application is being used and see if those give any clues.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Bill Tillman

  • Guest
Re: VB.NET - FileSystemWatcher Will Not Watch Novell Server Folder
« Reply #2 on: October 23, 2012, 11:53:37 AM »
OK, it appears that FileSystemWatcher does not work with Novell's NDS...or if there is a work-a-round I haven't found it yet. That's one of those minor details which can totally whack your project in the head. Oh well, I was looking for a solution when I came up with this one.

BlackBox

  • King Gator
  • Posts: 3770
Re: VB.NET - FileSystemWatcher Will Not Watch Novell Server Folder
« Reply #3 on: October 23, 2012, 12:05:15 PM »
You might give this a read, if you haven't already:

Quote from: MSDN, Framework Services Namespaces in Visual Studio

Framework Services Namespaces in Visual Studio

The namespaces in the .NET Framework for interacting with a variety of back-end server resources include the following:

<snip>

    System.DirectoryServices - consists of classes that provide easy access to the Active Directory from managed code. The classes in this namespace can be used with any one of the Active Directory service providers. The current providers are as follows: Internet Information Services (IIS), Lightweight Directory Access Protocol (LDAP), Novell NetWare Directory Service (NDS), and Windows NT. For more information about the Active Directory, see Directory Services in the .NET Framework.
"How we think determines what we do, and what we do determines what we get."

Bill Tillman

  • Guest
Re: VB.NET - FileSystemWatcher Will Not Watch Novell Server Folder
« Reply #4 on: October 23, 2012, 12:58:29 PM »
Thanks Renderman, I'm checking out that link now. I found this from another forum:

Quote
FileSystemWatcher will not work on a Novell Mapped Drive.  FileSystemWatcher is a wrapper for the ReadDirectoryChangesW Win32 API.  This API is limited to running on Windows ME, NT, 2000, and XP.  In addition to limitations on the client that can use this API, the API will only work on remote folders that reside on one of the above operating systems.

I'm sure this is listed somewhere in the docs for FileSystemWatcher but all the things I studied nowhere did I find any mention of it. And what should be appended to this quote is the following:

Quote
... and operating systems which run Windows emulation software like Samba on a Unix server.

This is what threw me for a loss when it failed to work at the office, because I was able to make it worth with no effort on my home LAN which is running Samba on FreeBSD server.

BlackBox

  • King Gator
  • Posts: 3770
Re: VB.NET - FileSystemWatcher Will Not Watch Novell Server Folder
« Reply #5 on: October 25, 2012, 08:00:56 AM »
Hey Bill,

Not sure if you've been able to make any progress with your dilemma, but I ran across this blog post while looking into the Autoloader mechanism, and found the part about IAdComFolderWatchReactor to be interesting... Looks like Kean  Fenton is using ARX, so you may have to port to .NET (if that's possible?).



"How we think determines what we do, and what we do determines what we get."