|
Have CopyProgressRoutine() post a message to the primasry thread indicating the percent done. The handler for that message will call the progress bar's "update" methods.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I'm stress testing a server that utilizes IO Completion Ports. For my test client, I'm just creating threads that perform many connect() calls to the server and leaving the socket connected so I can test my timeout mechanism on the server.
One thing of interest on the test client is a limit I hit on a per thread basis. If one thread loops with a call to connect() inside, just shy of connection number 3956, connect() fails and the system error reads "An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full."
I can drop the thread and start a new one from the same application and the cycle will repeat just fine. I tried increasing the threads stack size, etc... but it doesn't change it.
This is just a test client meant to beat up on my server, but I'm at a loss to explain why connect() always fails at roughly the same spot. I'm using the loopback address to test them on the same box.
Any guidance would be greatly appreciated.
|
|
|
|
|
There is a limit of 10,000 handles per process on Windows XP. I have no idea what the limit is on Vista. My guess is that you are reaching this limit.
Maximum NT User Handles Per Process Is 10,000 in Windows XP[^]
CreateIoCompletionPort consumes 1 handle as does each socket.
3956 * 2 = 7912
Not counting GDI/window and other types of handles.
You can try changing the registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\USERProcessHandleQuota to check if my theory is correct. I may be wrong.
Best Wishes,
-David Delaune
|
|
|
|
|
I've seen that limit in action with too many windows, gdi related handles etc...
However, my IOCP server which is on the same box is handling more than 30,000 sockets.
Thanks for the idea.
Any other suggestions?
|
|
|
|
|
Just for kicks, since I found a few references to locked page limits and references that talked about increasing the working set, I gave this a try but no change in behavior...
HANDLE hProcess=GetCurrentProcess();
if (hProcess) {
DWORD dwMin, dwMax;
if (GetProcessWorkingSetSize(hProcess, &dwMin, &dwMax)) {
TRACE("Before\n");
TRACE("Minimum working set: %lu Kbytes\n", dwMin/1024);
TRACE("Maximum working set: %lu Kbytes\n", dwMax/1024);
}
SetProcessWorkingSetSize(hProcess, 204800, 1413120*4);
if (GetProcessWorkingSetSize(hProcess, &dwMin, &dwMax)) {
TRACE("After\n");
TRACE("Minimum working set: %lu Kbytes\n", dwMin/1024);
TRACE("Maximum working set: %lu Kbytes\n", dwMax/1024);
}
}
|
|
|
|
|
I don't think increasing the working set will have any effect. Based on what I have read you can implement zero-byte read operations to prevent exceeding the locked pages limit. I believe you should focus your attention to two areas:
1.) Non-Paged pool limit.
2.) Locked pages limit.
Here is a sample chapter from Network Programming for Microsoft® Windows®, Second Edition[^] which addresses the issue.
Best Wishes,
-David Delaune
|
|
|
|
|
Funny, thats the same article I've been digging through.
I agree. I've been trying to reduce my usage to see if that allows the connection limit to vary.
Thanks again for taking the time out to post your comments.
|
|
|
|
|
Randor wrote: you can implement zero-byte read operations
Do you think he means put the socket in non-blocking mode, read, then put it back into blocking mode?
DWORD dwArg=1;
ioctlsocket(socketClient,FIONBIO,&dwArg); // Non-blocking mode
recv(socketClient,NULL,0,0);
dwArg=0;
ioctlsocket(socketClient,FIONBIO,&dwArg); // Blocking mode
|
|
|
|
|
I believe the best thing for you to do is take a look at the implementation by Len Holgate[^]. I have used his code in the past and was very impressed with the performance. It is available here:
http://www.lenholgate.com/archives/000637.html[^]
In SocketServer.cpp there is a function ZeroByteRead() which you should probably take a look at.
Best Wishes,
-David Delaune
|
|
|
|
|
Hello.
I have been working on an XPCOM component project in Visual C++ 2008 Express and have been trying to create a GNU Make-compatible Makefile to build the component with CL. Compiling within the IDE works fine, but I have a strange header error when using the same command line options with CL in my Makefile. I have to address this before adding the Link step.
I have this in my Makefile:
COMPONENT = MoonshineLua
GECKOSDK = C:\gecko-sdk
SOURCES = MoonshineLua.cpp MoonshineLuaModule.cpp
PPDEFS = WIN32 _DEBUG _WINDOWS _USRDLL LUAINTERPRETER_EXPORTS _UNICODE UNICODE
LIBS = nspr4.lib xpcom.lib xpcomglue_s.lib lua.lib
FIREFOX = C:\Program Files\Mozilla Firefox 3 Beta 5
# create the XPCOM component
make:
cl /Od /I "$(GECKOSDK)\include" /D "$(PPDEFS)" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" \
/Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP $(SOURCES)
I get this output when I run Make:
cl /Od /I "C:\gecko-sdk\include" /D "WIN32 _DEBUG _WINDOWS _USRDLL LUAINTERPRETER_EXPORTS _UNICODE UNICODE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" \
/Fd"Debug\vc90.pdb" /W3 /nologo /c /ZI /TP MoonshineLua.cpp MoonshineLuaModule.cpp
MoonshineLuaModule.cpp
c:\gecko-sdk\include\prtypes.h(61) : fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
MoonshineLua.cpp
c:\gecko-sdk\include\prtypes.h(61) : fatal error C1083: Cannot open include file: 'stddef.h': No such file or directory
Generating Code...
make: *** [make] Error 2
I checked prtypes.h and sure enough it includes stddef.h. This is a standard C header, so what is the problem? I know it must not be a problem, since I can build the component within the IDE wrong. So how can I solve this for use in the Makefile or the command line in general?
Thanks for any help.
|
|
|
|
|
Probably you have to add an option similar to
/I "C:\gecko-sdk\include" for the folder containing stddef.h .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
"make" cannot find the path for stddef.h, standard VS includes
You may go for trying make file project,
Or try setting the environment variables for Visual Studio Tools,
I don't know its path, in vs2005 it is vsvar32.bat, execute it before make in the command line
see this, [Building a C/C++ Program on the Command Line^]
modified on Thursday, May 8, 2008 10:39 AM
|
|
|
|
|
|
Thanks for your help.
I got it working with this:
# build the XPCOM component
make:
cl /Od /c /I "$(GECKOSDK)\include" /I "$(MSVC)\include" /D "$(PPDEFS)" \
/Gm /ZI /EHsc /MDd /Fo"Debug\\" /W3 /nologo /TP $(SOURCES)
link /OUT:"Debug\$(COMPONENT).dll" /NOLOGO \
/LIBPATH:"$(GECKOSDK)\lib" /LIBPATH:"$(MSVC)\lib" /LIBPATH:"$(WINSDK)\Lib" \
/DLL /MANIFEST /DEBUG /SUBSYSTEM:WINDOWS /MACHINE:X86 \
Debug\$(COMPONENT).obj Debug\$(COMPONENT)Module.obj $(LIBS)
|
|
|
|
|
in a dialog box ,there will be minimize,maximize,close buttons at the right-top end of the window.
if i click on close button , how to capture it ?
thanks in advance,
Anandi VC
|
|
|
|
|
WM_SYSCOMMAND / OnSysCommand / (eg)SC_CLOSE should do the trick, though I think in CDialog it ends up calling OnCancel, so you have less work to do - please verify for yourself.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
Thank u
|
|
|
|
|
Anandi.VC wrote: if i click on close button , how to capture it ?
The framework calls OnSysCommand(0xf060) , OnClose() , and OnCancel() , in that order.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thank u David .
Anandi VC
|
|
|
|
|
i checked it and it is calling all the three functions you menctioned but in the following order :
1) OnClose()
2) OnCancel()
3) OnSysCommand()
Thank u ,
Anandi VC
|
|
|
|
|
First-chance exception in DWB.exe (OLEAUT32.DLL): 0xC0000005: Access Violation.
Could any one tell me the meaning of the above sentence ?
i got this exception while working on VC6 and COM components.
thanks in advance,
Anandi VC
|
|
|
|
|
Anandi.VC wrote: Could any one tell me the meaning of the above sentence ?
You did something wrong within your program. That's about all we can say about it. But I know somebody who can help you much more than us, he is called Mr. Debugger
Joke aside, if you want to have more information about the problem, use your debugger: step into your program around the code which causes the problem, check the call stack, verify the different variables...
|
|
|
|
|
Cedric Moonen wrote: he is called Mr. Debugger
lol ....
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Invalid memory access. (buggy pointer?)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Anandi.VC wrote: First-chance exception in DWB.exe (OLEAUT32.DLL): 0xC0000005: Access Violation.
Could any one tell me the meaning of the above sentence ?
can be invalid pointer access. and what is First-Chance exception? When Exception Occurs debugger get notified and this first pass is called "First-Chance Exception", the debugger can then decide to pass to application to run normally if the exception was not handled by the application then the debugger gets notified again and is "second-chance exception" where the application must crash.
[First and second chance exception handling^]
Several cases the first chance exceptions don’t necessarily need to be dangerous and does not mean application's code is not proper.
for instance the following code causes first chance exception message to be written in output window
try
{
throw 100;
}
catch (...)
{
cout << "exception";
}
try
{
int *ptr = (int *)0x01;
*ptr = 1000;
}
catch (...)
{
cout << "exception";
}
but the application handled the exception, so you don't get second chance exception.
This may not be a buggy code, but if it is buggy you cannot find the exact position of exception as the default settings of the debugger won't break execution at first-chance exception, you can enable the debugger to break at First -chance Exception so that you can get the exact position. say in VS2005, "Debug->Exceptions: then check mark exception in the list". I don't remember in VS6.0 (its time to throw these old stuff dude )
modified on Thursday, May 8, 2008 11:05 AM
|
|
|
|