|
For creating high performance socket server, we use the technique of IO completion ports. We create IO completion port and related threads ourself using the function CreateIOCompletionPort().
There is also another function called BindIOCompletionCallback(). If we use this function we don't have to do the manual work. We simply let windows to create IO completion port and associate threads with it.
My question is that which solution is the more efficient, either manual creaton of IOCP or the later one.
|
|
|
|
|
what is the difference between Berkely sockets (Winsock2) and IO completion ports?
|
|
|
|
|
It sits on top off.
IO Completion ports are a WinNT feature that relate to all IO from disk access to Sockets. Basically you can use a limited number of threads to manage a large pool of connections at the same time while IO is pending.
Say 5 threads for 1000 connections is not unheard of. Because your not using a wasteful thread per connection with all the thread context switching goind on as the system scheduled them, then you get better efficiency, and the system is less likely to run out of resources, and suffer a denial of service attack. It helps get a lot more out of IO features on Windows which is useful for servers.
Read these to get a better feel.
http://www.codeproject.com/internet/winsockiocp.asp
http://www.codeproject.com/internet/iocp.asp
Also if you can get hold of a copy read Programming Server-Side Applications for Windows 2000 - Richter - MS Press. Has a good example of using them for searching files on the hard disk at a blinding speed.
|
|
|
|
|
Anonymous wrote:
BindIOCompletionCallback
This is only avaliable on Windows 2000 and later. If you need to support WinNT4 then you cannot use this as NT4 cannot manage the thread pool for you.
|
|
|
|
|
i create a CToolBar with no any buttons and dock it, it works well.
next i want to paint it, but i can't.
i override OnPint(), OnNcPaint() and disable WM_ERASEBACKGROUND message etc.
but the tool bar is still painted by microsoft, do u know how to paint it or disable which message so microsoft will not paint it then i can paint myself?
thx
includeh10
|
|
|
|
|
Handle NM_CUSTOMDRAW. You can change colors and button styles in response to that message - see the MSDN docs for the full list of capabilities.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
i create a CWnd with WS_THICKFRAME style (need to resize the window), and want to paint its border.
in OnNcPaint() message, i try all DCs:
1. CPintDC(this), not work, noly for client area
2. CWindowDC(this), only can draw left and top borders, not available for right and bottom borders
3. GetDC(0), OK, but draw on screen DC, sometimes makes screen dirty.
could u give me a hint?
thx
includeh10
|
|
|
|
|
Handle WM_NCPAINT
NC == Non Client
Normski. - Professional Windows Programmer
|
|
|
|
|
before u waste time, read question first, or waste my time also
includeh10
|
|
|
|
|
before you send emails to me, don't be so f***ing rude.
Normski. - Professional Windows Programmer
|
|
|
|
|
Hi,
I have a bitmap file with image size 720*480. Now i want to draw a part of this image, such as draw the image within a rectangle
rect(360, 420, 240, 280). Is there a simple method to do this?
Best Regards,
chen
|
|
|
|
|
BitBlt and StretchBlt both allow you to specify the part of the image to draw.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
it depands speed u need for drawing.
1. if need high speed, u have to draw it from file buffer, in the case, u need to know bitmap format, it is not too hard, but hard to draw because all DC functions are nor available.
2. create a memory DC, display bmp file on it, then draw it with DC functions. if u want to change ur file, save it according to ur memory DC.
includeh10
|
|
|
|
|
Thanks for the reply. It worked!
Best Regards,
chen
|
|
|
|
|
Hi, can someone show me a code or webpage to get size and position of a CDialog? how do I set position and size again? Thanks for help.
|
|
|
|
|
GetWindowRect & SetWindowPos
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Hi,
I'm using the function WNetAddConnection2( ) in my application.But on compiling my project it gives the following Linker error.
Generating Code...
Linking...
BackupDlg.obj : error LNK2001: unresolved external symbol _WNetAddConnection2A@16
Debug/Backup.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
can anyone help me?
With regards
Shibu K.V.
Senior Research Associate.
VLSI ASIC Hardware Design Group
Electronics R&D Centre,Trivandrum
India
|
|
|
|
|
I assume your linking in Mpr.lib?
Normski. - Professional Windows Programmer
|
|
|
|
|
Are there any articles on the help features like the "?" box in the right hand corner and things associated with that on this site? I can't seem to find any.
-Raffi
|
|
|
|
|
I have a class which can calculate a mathematics expression,such as "sin(x)+cos(x)",when given a number to x, it could return the value of the expression.It works in two steps:At first,it parses the expression,and then,it calculates.I have a list of x's values,all of them are used in the expression "sin(x)+cos(x)",so they are calculated in the same way,but the class parses the expression for each x value,you see, it does the same work many many times.What can I do if I want the class to parse once but calculate all?
|
|
|
|
|
Make a static array, which is a lookup table. Then each sin or cos is calculated exactly once.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Hi All,
I need a Lint checker or something simular for my large C++ program in order to find a bug that is crashing it.
Can anyone suggest a good Lint Checker? Really, I would love a free one??
Thanks !
Philip
|
|
|
|
|
Lint may be of some use, but I'd surprised if it would pinpoint your crash.
Have you tried running a Debug Build under the VC Debugger and inspecting where the crash occures when it happens?
Also have a look at the various BugSlayer articles by John Robbins on the MS MSDN Web site http://msdn.microsoft.com/default.asp and "Improved Error Reporting with DBGHELP 5.1 APIs" http://msdn.microsoft.com/msdnmag/issues/02/03/Hood/Hood0203.asp
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
This is a new one for me.
I have a buffer, i.e., char buffer[100]. I need to copy the contents of the buffer into a BSTR that is already allocated and already has a value. Basically, I need to change the value of the BSTR before I send it to another method that requires a BSTR. I cannot figure out how to do this? Any advice?
Thanks for any help,
Shanti
|
|
|
|
|
comutils.h includes a wrapper class called _bstr_t. You can do this:
HRESULT MyFunc(/*[in, out]*/BSTR * bstr)
{
_bstr_t b_tWrap(*bstr, false); // FALSE means the _bstr_t takes ownership
b_tWrap = mycharbuffer;
*bstr = b_tWrap.Release();
}
Something like that.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|