FindFirstChangeNotification() results in "The network BIOS command limit has been reached."
-
so i think because your polling the call FindFirstChangeNotification() in an infinite loop it cries might try adding a lil timer to the thread and put the contents of the do{}while(1) in the thread OnTimer event setting the polling interval to be something sensible
But the loop gets suspended at WaitOnMultipleObjects() after the very FIRST invocation of FindFirstChangeNotification(). (The whole reason for using this approach is to get away from a polling mechanism which introduces a delay) As I said originally, the code works fine when the target is a local disk - something to do with network, and I don't know how to fix it !!)
Doug
-
But the loop gets suspended at WaitOnMultipleObjects() after the very FIRST invocation of FindFirstChangeNotification(). (The whole reason for using this approach is to get away from a polling mechanism which introduces a delay) As I said originally, the code works fine when the target is a local disk - something to do with network, and I don't know how to fix it !!)
Doug
i am thinking that WaitOnMultipleObjects()doesnt "wait" that long (assumption about to make an ass of me) try printing out a gettickcount() or something in the do loop and see if that is the case. [edit] and yes assupmtion has made an ass of me once again http://support.microsoft.com/kb/810886[^] [edit]
-
i am thinking that WaitOnMultipleObjects()doesnt "wait" that long (assumption about to make an ass of me) try printing out a gettickcount() or something in the do loop and see if that is the case. [edit] and yes assupmtion has made an ass of me once again http://support.microsoft.com/kb/810886[^] [edit]
Hi Killabyte, Actually, I'm getting the problem single-stepping in the debugger, so the loop isn't executing as such. Also the WaitOnMultipleObjects() has an INFINITE timeout. I don't quite know how FindFirstChangeNotification() is implemented, but presumably the problem resides in the firmware of the network disk controller - have logged on to it, but can't see any parameters in the SMB server that I can tweak. Or am I missing something here ?
Doug
-
Hi Killabyte, Actually, I'm getting the problem single-stepping in the debugger, so the loop isn't executing as such. Also the WaitOnMultipleObjects() has an INFINITE timeout. I don't quite know how FindFirstChangeNotification() is implemented, but presumably the problem resides in the firmware of the network disk controller - have logged on to it, but can't see any parameters in the SMB server that I can tweak. Or am I missing something here ?
Doug
-
Here is the code in my worker thread, as requested:- UINT WaitNewScheduleThread(LPVOID Param) //20090723 { CWinThread* pThread = AfxGetThread(); int iID = pThread->m_nThreadID; CString szLogMsg; szLogMsg.Format("\n>>> Worker thread ID = 0x%X\n",iID); OutputDebugString(szLogMsg); CMCManagerBEDlg* pDlg = (CMCManagerBEDlg*)Param; CMCManagerBEApp* pApp; pApp = (CMCManagerBEApp*)AfxGetApp(); HANDLE hCN; CString szPathName; szPathName.Format("Z:\\WinDVR"); //szPathName.Format("C:\\Dell"); // Set up array of two handles HANDLE hExitEvent; hExitEvent = pApp->m_hExitEvent; HANDLE handles[2]; int iRetCode; DWORD dwRC; DWORD err; do { hCN = FindFirstChangeNotification(szPathName,FALSE,FILE_NOTIFY_CHANGE_FILE_NAME); if(hCN == INVALID_HANDLE_VALUE) err = GetLastError(); handles[0] = hCN; handles[1] = pApp->m_hExitEvent; dwRC = WaitForMultipleObjects(2,handles,FALSE,INFINITE); if(dwRC == WAIT_OBJECT_0) { szLogMsg.Format("Found new file on %s",szPathName); g_pLogFile->Add(szLogMsg); OutputDebugString(szLogMsg); if(g_pDlg->m_bPermitSchedUpdate) &
Hi, a quick look at the code shows that the handle will not be closed. From MSDN: When the handle is no longer needed, it can be closed by using the FindCloseChangeNotification function. So I guess the error will show up after the loop has been executed a few times? Regards Frank
-
Hi again, I had seen <a href="http://support.microsoft.com/kb/810886\[^\]">http://support.microsoft.com/kb/810886\[^\]</a>[<a href="http://support.microsoft.com/kb/810886\[^\]" target="_blank" title="New Window">^</a>] already - it only seems (unless I have missed something) to address the situation where the FindFirstChangeNotification() is aimed at a SERVER and then you can edit it's registry accordingly. In this case, the target is a network disk and that is why I logged on to it to see what parameters were available for tweaking - basically none !) I'd be surprised if I'm the first person to hit such a problem ! P.S. I clearly don't know how to insert a link (copied from a previous posting) in a new posting !!
Doug
-
Hi, a quick look at the code shows that the handle will not be closed. From MSDN: When the handle is no longer needed, it can be closed by using the FindCloseChangeNotification function. So I guess the error will show up after the loop has been executed a few times? Regards Frank
Hi Frank, Getting the problem whilst single-stepping in the debugger !
Doug
-
Hi again, I had seen <a href="http://support.microsoft.com/kb/810886\[^\]">http://support.microsoft.com/kb/810886\[^\]</a>[<a href="http://support.microsoft.com/kb/810886\[^\]" target="_blank" title="New Window">^</a>] already - it only seems (unless I have missed something) to address the situation where the FindFirstChangeNotification() is aimed at a SERVER and then you can edit it's registry accordingly. In this case, the target is a network disk and that is why I logged on to it to see what parameters were available for tweaking - basically none !) I'd be surprised if I'm the first person to hit such a problem ! P.S. I clearly don't know how to insert a link (copied from a previous posting) in a new posting !!
Doug
oh crap. so your saying that there is no registry edit applicable on your target network disk? i would have thought that if there is no "server" so to speak of then the client side registry would be altered? but then again who said logic plays a part in software development haha
-
oh crap. so your saying that there is no registry edit applicable on your target network disk? i would have thought that if there is no "server" so to speak of then the client side registry would be altered? but then again who said logic plays a part in software development haha
Hi Killabyte, Yes !! When you logon to 192.168.1.9 using a browser, the facilities provided are minimal. Don't forget that the whole thing is implemented in firmware !! Basically, I'm beginning to think that I'm at it's mercy, and I'm stuffed !!! (Will have to stick with my old polling mechanism after all ... unless someone knows different ...... !
Doug
-
My MFC application needs to monitor a directory on a network disk (mapped as Z:), and I'm using FindFirstChangeNotification() to do this. However, I am getting an INVALID_HANDLE_VALUE returned, and GetLastError() return 56 (which appears to be "The network BIOS command limit has been reached." If I change the path of the monitored folder to a local drive, it works fine. How do I get over this problem ? (MSVC 6.0 - Win2000) (All the results from a Google search only seem to refer to a server situation)
Doug