What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Winsock & I/O Completion Ports

Winsock & I/O Completion Ports
Author: Message:
andrewdodd13
Senior Member
****

Avatar
Oh so retro

Posts: 870
Reputation: 16
34 / Male / Flag
Joined: Jan 2005
O.P. Winsock & I/O Completion Ports
I've got some (read: a lot) of code that I'm kind of in a muddle over. Basically, it's a server program which is designed to handle lots of concurrent connections which uses Winsock2 and I/O Completion Ports.

The main body of the WorkerThread gets an object from the Completion Queue [type CClientDS] and then does some work based on it's current state. Generally work is defined as READ from socket then SEND response.

The problem I'm having is with this bit of code:
code:
iResult = WSARecv(pClientDS->GetSocket(), p_wbuf, 1, &dwBytes, &dwFlags, p_ol, NULL);

if(iResult == SOCKET_ERROR && WSAGetLastError() != WSA_IO_PENDING) {
    logMessage(iThreadID, "si", "Client disconnected. ", WSAGetLastError());
    pClientDS->SetOpCode(INVALID);
} else if (WSAGetLastError() == WSA_IO_PENDING) {
    // This procs. And I don't know what to do about it
}

Basically, as you can probably see from the comment, the IO operation is still pending, but I don't know what to do! I tried putting break; here, but then we never get this item from the Completion Queue again.

I can't act on the p_wbuf buffer until I know I have the correct data.

Anyone know what to do? Help would be much appreciated.

This post was edited on 03-18-2008 at 02:41 PM by andrewdodd13.
[Image: AndrewsStyle.png]
03-18-2008 02:40 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On