Member Avatar for JenniLei

Hello guys, I am having trouble getting an asyncronous communications set up using overlapping. Actually to be more specific I am having problems with using httpWaitForDisconnect to work as async.
Using the code below I am able to enter the function, but it is in a blocking state which defeats all the purposes of me trying to use this function in the first place.
The Code:

HANDLE hQueue;
HTTP_REQUEST* pHttpData;
ULONG ulReturn = 0;

OVERLAPPED* ovlp;
	ZeroMemory(&ovlp, sizeof(&ovlp));
ulReturn = HttpReceiveHttpRequest(hQueue, RequestId, 0, pHttpData, dwBufferSize, &dwSizeReceived, ovlp);
RequestId = pHttpData->RequestId;
		if (ulReturn == ERROR_INVALID_PARAMETER)  {
			AddToTraceLog("HttpReceiveHttpRequest : Invalid Parameter");
		}

		AddToTraceLog("Going into the disconnect");
		ulReturn = HttpWaitForDisconnect(hQueue, pHttpData->ConnectionId, ovlp);
		switch(ulReturn)
		{
		case NO_ERROR:
			AddToTraceLog("User Has Disconnected...");
			break;
		case ERROR_IO_PENDING:
			AddToTraceLog("IO Pending, next request not ready...");
			break;
		case ERROR_INVALID_PARAMETER:
			AddToTraceLog("Error" + getLastError());
			break;
		}

Thank you in advance.

Member Avatar for JenniLei

nevermind the post, got it working :).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.