Bob Sheep
March 5th, 2004, 10:05 AM
It's been annoying me for some time that MFC sockets don't seem to work under heavy usage. I have an app which handles 2000+ concurrent TCP connections and when the server app starts up and start accepting client requests it hangs. I solved the problem by writing my own non-mfc socket class.
But looking at CSocket I think I've found a bug so I invite all those CSocket gurus to see if I'm right.
In PumpMessages if the message is a socket notification for a socket for which we're not interested in (that is not the current socket) the msg is placed in the AuxQueue. When we finally process the notification for our socket a WM_SOCKET_NOTIFY is posted to process the accumulated socket notifications for other sockets handled by this thread.
But..... If CancelBlockingCall is called from OnMessagePending (as you would for a timeout) then the message is never posted because WSAEINTR is returned leaving these messages unprocessed until the code gets around to posting another WM_SOCKET_NOTIFY.
The code is the same for VC++ 6.0, &.0 and 7.1
I think I'm right but I'd like others to see if they can agree/disagree with me.
But looking at CSocket I think I've found a bug so I invite all those CSocket gurus to see if I'm right.
In PumpMessages if the message is a socket notification for a socket for which we're not interested in (that is not the current socket) the msg is placed in the AuxQueue. When we finally process the notification for our socket a WM_SOCKET_NOTIFY is posted to process the accumulated socket notifications for other sockets handled by this thread.
But..... If CancelBlockingCall is called from OnMessagePending (as you would for a timeout) then the message is never posted because WSAEINTR is returned leaving these messages unprocessed until the code gets around to posting another WM_SOCKET_NOTIFY.
The code is the same for VC++ 6.0, &.0 and 7.1
I think I'm right but I'd like others to see if they can agree/disagree with me.