Re: HTTP server problem when running two clients



Hello there,

The first thing I notice is that you allocate:

RequestBufferLength = sizeof(HTTP_REQUEST) + 2048;

But what happens if the HttpReceiveHttpRequest needs more data? I'd suggest
to check against ERROR_MORE_DATA and if HttpReceiveHttpRequest returns this
error, re-allocate more wide buffer.

--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
"volynsky" <volynsky@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7C97F997-DD14-438F-AC4E-4CB02376F036@xxxxxxxxxxxxxxxx
Many ,many, many thanks to Volodymyr M. Shcherbyna !!!
I was on vacation therefore could not return the answer at once.

On the server side I do the following (I used the example in the msdn):

ULONG result;
HTTP_REQUEST_ID requestId;
DWORD bytesRead;
PHTTP_REQUEST pRequest;
PCHAR pRequestBuffer;
ULONG RequestBufferLength;
int i = 0;
SYSTEMTIME StartTime;
SYSTEMTIME EndTime;
int k;


RequestBufferLength = sizeof(HTTP_REQUEST) + 2048;
pRequestBuffer = ALLOC_MEM( RequestBufferLength );

if (pRequestBuffer == NULL)
{
return ERROR_NOT_ENOUGH_MEMORY;
}

pRequest = (PHTTP_REQUEST)pRequestBuffer;


HTTP_SET_NULL_ID( &requestId );

for(;;)
{
RtlZeroMemory(pRequest, RequestBufferLength);

result = HttpReceiveHttpRequest(hReqQueue, requestId,

HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY,
pRequest, RequestBufferLength,
&bytesRead,
NULL
);
:::
}

As far as I understood the function HttpReceiveHttpRequest knows to get
requests in parallel, and then on each loop the buffer in pRequest
contain a
single request data. Therefor, I didn't think that I should add
synchronization. Was I right? If I should add synchronization, where
should I
add it?



.