Hello. I am applying a demo project in which I use winhttp asynchronously via callback.
After cyclic sending of n-requests, error 12029 is often generated. If you insert Sleep in the code, then
all words go away without errors. I would like to understand how you can without sleep. Made specifically so that later
tie the call to the queue.
#include "stdafx.h"
#include <windows.h>
#include <winhttp.h>
#include <stdio.h>
#pragma comment(lib,"winhttp")
typedef struct {
HINTERNET hSession; HINTERNET hConnect; HINTERNET hRequest; DWORD dwSize; DWORD dwTotalSize; LPSTR lpBuffer; char* SendBuffer; wchar_t* URL; int Resend; DWORD SendTimeout; DWORD ReceiveTimeout; DWORD ConnectTimeout; DWORD ResolveTimeout; bool IsBadRequest; WINHTTP_STATUS_CALLBACK pCallback;
} REQUEST_CONTEXT;
int CounterGood = 0;
int CounterBad = 0;
#define CASE_OF(constant) case constant: return (L# constant)
LPCWSTR GetApiErrorString(DWORD dwResult)
{
switch(dwResult)
{
CASE_OF( API_RECEIVE_RESPONSE );
CASE_OF( API_QUERY_DATA_AVAILABLE );
CASE_OF( API_READ_DATA );
CASE_OF( API_WRITE_DATA );
CASE_OF( API_SEND_REQUEST );
}
return L"Unknown function";
}
void Cleanup (REQUEST_CONTEXT *cpContext)
{
if (!cpContext)
{
return;
}
if (cpContext->IsBadRequest)
CounterBad++;
else
CounterGood++;
WCHAR szBuffer[256];
swprintf(szBuffer,sizeof(szBuffer), L"Cleanup");
if (cpContext->hRequest)
{
swprintf(szBuffer, sizeof(szBuffer), L">WinHttpSetStatusCallback NULL");
WinHttpSetStatusCallback(cpContext->hRequest, NULL, NULL, NULL);
swprintf(szBuffer, sizeof(szBuffer), L"<WinHttpSetStatusCallback NULL");
swprintf(szBuffer, sizeof(szBuffer), L">WinHttpCloseHandle hRequest (%X)", (unsigned int)cpContext->hRequest);
WinHttpCloseHandle(cpContext->hRequest);
swprintf(szBuffer, sizeof(szBuffer), L"<WinHttpCloseHandle");
cpContext->hRequest = NULL;
}
if (cpContext->hConnect)
{
swprintf(szBuffer, sizeof(szBuffer), L">WinHttpCloseHandle hConnect (%X)", (unsigned int)cpContext->hConnect);
WinHttpCloseHandle(cpContext->hConnect);
swprintf(szBuffer, sizeof(szBuffer), L"<WinHttpCloseHandle");
cpContext->hConnect = NULL;
}
if (cpContext->hSession)
{
swprintf(szBuffer, sizeof(szBuffer), L">WinHttpCloseHandle hConnect (%X)", (unsigned int)cpContext->hSession);
WinHttpCloseHandle(cpContext->hSession);
swprintf(szBuffer, sizeof(szBuffer), L"<WinHttpCloseHandle");
cpContext->hSession = NULL;
}
delete [] cpContext->lpBuffer;
cpContext->lpBuffer = NULL;
if (cpContext->SendBuffer)
{
delete cpContext->SendBuffer;
cpContext->SendBuffer = NULL;
}
if (cpContext && cpContext->URL)
{
delete cpContext->URL;
cpContext->URL = NULL;
}
delete cpContext;
cpContext = NULL;
}
void __stdcall AsyncCallback(HINTERNET, DWORD_PTR, DWORD, LPVOID, DWORD);
BOOL SendRequest(REQUEST_CONTEXT *cpContext)
{
if (!cpContext) return FALSE;
if (!cpContext->URL) return FALSE;
WCHAR szHost[256];
DWORD dwOpenRequestFlag = 0;
URL_COMPONENTS urlComp;
BOOL fRet = FALSE;
WCHAR szBuffer[256];
ZeroMemory(&urlComp, sizeof(urlComp));
urlComp.dwStructSize = sizeof(urlComp);
urlComp.lpszHostName = szHost;
urlComp.dwHostNameLength = sizeof(szHost) / sizeof(szHost[0]);
urlComp.dwUrlPathLength = -1;
urlComp.dwSchemeLength = -1;
swprintf( szBuffer, sizeof(szBuffer), L">Calling WinHttpCrackURL for %s", cpContext->URL);
if (!WinHttpCrackUrl(cpContext->URL, 0, 0, &urlComp))
{
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpCrackUrl failed : %X", GetLastError());
goto cleanup;
}
if (cpContext->pCallback == NULL)
{
swprintf(szBuffer, sizeof(szBuffer), L">Calling WinHttpSetStatusCallback with WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS");
cpContext->pCallback = WinHttpSetStatusCallback(cpContext->hSession,
(WINHTTP_STATUS_CALLBACK)AsyncCallback,
WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS,
NULL);
}
if (cpContext->pCallback == WINHTTP_INVALID_STATUS_CALLBACK)
{
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpSetStatusCallback WINHTTP_INVALID_STATUS_CALLBACK");
goto cleanup;
}
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpSetStatusCallback succeeded");
swprintf(szBuffer, sizeof(szBuffer), L">Calling WinHttpConnect for host %s and port %d", szHost, urlComp.nPort);
cpContext->hConnect = WinHttpConnect(cpContext->hSession, szHost, urlComp.nPort, 0);
if (NULL == cpContext->hConnect)
{
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpConnect failed : %X", GetLastError());
goto cleanup;
}
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpConnect succeeded");
swprintf(szBuffer, sizeof(szBuffer), L"> Calling WinHttpGetIEProxyConfigForCurrentUser");
dwOpenRequestFlag = (INTERNET_SCHEME_HTTPS == urlComp.nScheme) ?
WINHTTP_FLAG_SECURE : 0;
swprintf(szBuffer, sizeof(szBuffer), L">Calling WinHttpOpenRequest");
cpContext->hRequest = WinHttpOpenRequest(cpContext->hConnect,
L"GET", urlComp.lpszUrlPath,
NULL, WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
dwOpenRequestFlag);
if (cpContext->hRequest == 0)
{
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpOpenRequest failed : %X", GetLastError());
goto cleanup;
}
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpOpenRequest succeeded");
swprintf( szBuffer, sizeof(szBuffer), L"> Calling WinHttpSendRequest");
if (cpContext->Resend == 0)
if (!WinHttpSetTimeouts(cpContext->hRequest,cpContext->ResolveTimeout,cpContext->ConnectTimeout,cpContext->SendTimeout,cpContext->ReceiveTimeout))
{
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpSetTimeouts failed : %X", GetLastError());
goto cleanup;
}
DWORD f = 0;
if (cpContext->SendBuffer)
{
f = strlen(cpContext->SendBuffer);
}
swprintf( szBuffer, sizeof(szBuffer), L"> Calling WinHttpSendRequest");
if (!WinHttpSendRequest(cpContext->hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, cpContext->SendBuffer,f,f, (DWORD_PTR)cpContext))
{
swprintf(szBuffer, sizeof(szBuffer), L"< WinHttpSendRequest failed : %X", GetLastError());
goto cleanup;
}
fRet = TRUE;
cleanup:
if (fRet == FALSE)
{
WCHAR szError[256];
swprintf(szError, sizeof(szBuffer), L"%s failed with error %d", szBuffer, GetLastError());
Cleanup(cpContext);
}
return fRet;
}
BOOL Header(REQUEST_CONTEXT *cpContext)
{
DWORD dwSize=0;
LPVOID lpOutBuffer = NULL;
WCHAR szBuffer[256];
swprintf(szBuffer, sizeof(szBuffer), L">Calling WinHttpQueryHeaders");
if (!WinHttpQueryHeaders( cpContext->hRequest,
WINHTTP_QUERY_RAW_HEADERS_CRLF,
WINHTTP_HEADER_NAME_BY_INDEX, NULL, &dwSize, WINHTTP_NO_HEADER_INDEX))
{
DWORD dwErr = GetLastError();
if (dwErr != ERROR_INSUFFICIENT_BUFFER)
{
swprintf( szBuffer, sizeof(szBuffer), L"Error %d encountered.", dwErr);
return FALSE;
}
}
lpOutBuffer = new WCHAR[dwSize];
if(WinHttpQueryHeaders( cpContext->hRequest,
WINHTTP_QUERY_RAW_HEADERS_CRLF,
WINHTTP_HEADER_NAME_BY_INDEX, lpOutBuffer, &dwSize, WINHTTP_NO_HEADER_INDEX))
{
}
delete [] lpOutBuffer;
return TRUE;
}
BOOL QueryData(REQUEST_CONTEXT *cpContext)
{
WCHAR szBuffer[256];
swprintf( szBuffer, sizeof(szBuffer), L">Calling WinHttpQueryDataAvailable");
if (WinHttpQueryDataAvailable(cpContext->hRequest, NULL) == FALSE)
{
DWORD dwErr = GetLastError();
swprintf( szBuffer, sizeof(szBuffer), L"Error %d encountered.", dwErr);
return FALSE;
}
return TRUE;
}
void TransferAndDeleteBuffers(REQUEST_CONTEXT *cpContext, LPSTR lpReadBuffer, DWORD dwBytesRead)
{
cpContext->dwSize = dwBytesRead;
if(!cpContext->lpBuffer)
{
cpContext->lpBuffer = lpReadBuffer;
}
else
{
LPSTR lpOldBuffer = cpContext->lpBuffer;
cpContext->lpBuffer = new char[cpContext->dwTotalSize + cpContext->dwSize];
memcpy(cpContext->lpBuffer, lpOldBuffer, cpContext->dwTotalSize);
memcpy(cpContext->lpBuffer + cpContext->dwTotalSize, lpReadBuffer, cpContext->dwSize);
delete [] lpOldBuffer;
delete [] lpReadBuffer;
}
cpContext->dwTotalSize += cpContext->dwSize;
}
BOOL ReadData(REQUEST_CONTEXT *cpContext)
{
LPSTR lpOutBuffer = new char[cpContext->dwSize+1];
WCHAR szBuffer[256];
ZeroMemory(lpOutBuffer, cpContext->dwSize+1);
swprintf( szBuffer, sizeof(szBuffer), L">Calling WinHttpReadData with size %d", cpContext->dwSize);
if (WinHttpReadData( cpContext->hRequest, (LPVOID)lpOutBuffer,
cpContext->dwSize, NULL) == FALSE)
{
DWORD dwErr = GetLastError();
swprintf( szBuffer, sizeof(szBuffer), L"WinHttpReadData Error %d encountered.", dwErr);
delete [] lpOutBuffer;
return FALSE;
}
swprintf(szBuffer, sizeof(szBuffer), L"<WinHttpReadData");
return TRUE;
}
void __stdcall AsyncCallback( HINTERNET hInternet, DWORD_PTR dwContext,
DWORD dwInternetStatus,
LPVOID lpvStatusInformation,
DWORD dwStatusInformationLength)
{
REQUEST_CONTEXT *cpContext;
WCHAR szBuffer[1024];
cpContext = (REQUEST_CONTEXT*)dwContext;
WINHTTP_ASYNC_RESULT *pAR;
if (cpContext == NULL)
{
return;
}
szBuffer[0] = 0;
switch (dwInternetStatus)
{
case WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION:
swprintf(szBuffer, sizeof(szBuffer), L"CLOSING_CONNECTION (%d)", dwStatusInformationLength);
break;
case WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"CONNECTED_TO_SERVER (%s)", (WCHAR *)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"CONNECTED_TO_SERVER (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"CONNECTING_TO_SERVER (%s)", (WCHAR *)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"CONNECTING_TO_SERVER (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED:
swprintf(szBuffer, sizeof(szBuffer), L"CONNECTION_CLOSED (%d)", dwStatusInformationLength);
break;
case WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE:
cpContext->dwSize = *((LPDWORD)lpvStatusInformation);
if (cpContext->dwSize == 0)
{
swprintf(szBuffer, sizeof(szBuffer), L"DATA_AVAILABLE Number of bytes available : %d. All data has been read -> Displaying the data.", cpContext->dwSize);
if (cpContext->dwTotalSize)
{
LPWSTR lpWideBuffer = new WCHAR[cpContext->dwTotalSize + 1];
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
cpContext->lpBuffer,
cpContext->dwTotalSize,
lpWideBuffer,
cpContext->dwTotalSize);
lpWideBuffer[cpContext->dwTotalSize] = 0;
delete[] lpWideBuffer;
delete[] cpContext->lpBuffer;
cpContext->lpBuffer = NULL;
}
Cleanup(cpContext);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"DATA_AVAILABLE Number of bytes available : %d. Reading next block of data", cpContext->dwSize);
if (ReadData(cpContext) == FALSE)
{
swprintf(szBuffer, sizeof(szBuffer), L"DATA_AVAILABLE Number of bytes available : %d. ReadData returning FALSE", cpContext->dwSize);
Cleanup(cpContext);
}
}
break;
case WINHTTP_CALLBACK_STATUS_HANDLE_CREATED:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"HANDLE_CREATED : %X", (unsigned int)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"HANDLE_CREATED (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"HANDLE_CLOSING : %X", (unsigned int)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"HANDLE_CLOSING (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE:
swprintf(szBuffer, sizeof(szBuffer), L"HEADERS_AVAILABLE (%d)", dwStatusInformationLength);
Header(cpContext);
cpContext->dwSize = 0;
cpContext->dwTotalSize = 0;
if (QueryData(cpContext) == FALSE)
{
Cleanup(cpContext);
}
break;
case WINHTTP_CALLBACK_STATUS_INTERMEDIATE_RESPONSE:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"INTERMEDIATE_RESPONSE Status code : %d", *(DWORD*)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"INTERMEDIATE_RESPONSE (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_NAME_RESOLVED:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"NAME_RESOLVED : %s", (WCHAR *)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"NAME_RESOLVED (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_READ_COMPLETE:
swprintf(szBuffer, sizeof(szBuffer), L"READ_COMPLETE Number of bytes read : %d", dwStatusInformationLength);
if (dwStatusInformationLength != 0)
{
TransferAndDeleteBuffers(cpContext, (LPSTR)lpvStatusInformation, dwStatusInformationLength);
if (QueryData(cpContext) == FALSE)
{
Cleanup(cpContext);
}
}
break;
case WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE:
swprintf(szBuffer, sizeof(szBuffer), L"RECEIVING_RESPONSE (%d)", dwStatusInformationLength);
break;
case WINHTTP_CALLBACK_STATUS_REDIRECT:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"REDIRECT to %s", (WCHAR *)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"REDIRECT (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR:
pAR = (WINHTTP_ASYNC_RESULT *)lpvStatusInformation;
swprintf(szBuffer, sizeof(szBuffer), L"REQUEST_ERROR - error %d, result %s", pAR->dwError, GetApiErrorString(pAR->dwResult));
if (cpContext)
cpContext->IsBadRequest = true;
Cleanup(cpContext);
break;
case WINHTTP_CALLBACK_STATUS_REQUEST_SENT:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"REQUEST_SENT Number of bytes sent : %d", *(DWORD*)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"REQUEST_SENT (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_RESOLVING_NAME:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"RESOLVING_NAME %s", (WCHAR*)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"RESOLVING_NAME (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"RESPONSE_RECEIVED. Number of bytes : %d", *(DWORD*)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"RESPONSE_RECEIVED (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_SECURE_FAILURE:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"SECURE_FAILURE (%d).", *(DWORD*)lpvStatusInformation);
if (*(DWORD*)lpvStatusInformation & WINHTTP_CALLBACK_STATUS_FLAG_CERT_REV_FAILED) {
wcscat_s(szBuffer, L"Revocation check failed to verify whether a certificate has been revoked.");
}
if (*(DWORD*)lpvStatusInformation & WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CERT) {
wcscat_s(szBuffer, L"SSL certificate is invalid.");
}
if (*(DWORD*)lpvStatusInformation & WINHTTP_CALLBACK_STATUS_FLAG_CERT_REVOKED) {
wcscat_s(szBuffer, L"SSL certificate was revoked.");
}
if (*(DWORD*)lpvStatusInformation & WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA) {
wcscat_s(szBuffer, L"The function is unfamiliar with the Certificate Authority that generated the server's certificate.");
}
if (*(DWORD*)lpvStatusInformation & WINHTTP_CALLBACK_STATUS_FLAG_CERT_CN_INVALID) {
wcscat_s(szBuffer, L"SSL certificate common name(host name field) is incorrect");
}
if (*(DWORD*)lpvStatusInformation & WINHTTP_CALLBACK_STATUS_FLAG_CERT_DATE_INVALID) {
wcscat_s(szBuffer, L"CSSL certificate date that was received from the server is bad.The certificate is expired.");
}
if (*(DWORD*)lpvStatusInformation & WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR) {
wcscat_s(szBuffer, L"The application experienced an internal error loading the SSL libraries.");
}
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"SECURE_FAILURE (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_SENDING_REQUEST:
swprintf(szBuffer, sizeof(szBuffer), L"SENDING_REQUEST (%d)", dwStatusInformationLength);
break;
case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE:
swprintf(szBuffer, sizeof(szBuffer), L"SENDREQUEST_COMPLETE (%d)", dwStatusInformationLength);
if (WinHttpReceiveResponse( cpContext->hRequest, NULL) == FALSE)
{
Cleanup(cpContext);
}
break;
case WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE:
if (lpvStatusInformation)
{
swprintf(szBuffer, sizeof(szBuffer), L"WRITE_COMPLETE (%d)", *(DWORD*)lpvStatusInformation);
}
else
{
swprintf(szBuffer, sizeof(szBuffer), L"WRITE_COMPLETE (%d)", dwStatusInformationLength);
}
break;
case WINHTTP_CALLBACK_STATUS_GETPROXYFORURL_COMPLETE:
swprintf(szBuffer, sizeof(szBuffer), L"GETPROXYFORURL_COMPLETE (%d)", dwStatusInformationLength);
break;
case WINHTTP_CALLBACK_STATUS_CLOSE_COMPLETE:
swprintf(szBuffer, sizeof(szBuffer), L"CLOSE_COMPLETE (%d)", dwStatusInformationLength);
break;
case WINHTTP_CALLBACK_STATUS_SHUTDOWN_COMPLETE:
swprintf(szBuffer, sizeof(szBuffer), L"SHUTDOWN_COMPLETE (%d)", dwStatusInformationLength);
break;
default:
swprintf(szBuffer, sizeof(szBuffer),L"Unknown/unhandled callback - status %d given", dwInternetStatus);
break;
}
printf("%wsn",szBuffer);
}
int main()
{
#define ZC L"http://127.0.0.1:40450"
for (int i = 0; i < 2000; i++)
{
HANDLE hSession = WinHttpOpen( L"Asynchronous WinHTTP Demo",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS,
WINHTTP_FLAG_ASYNC);
if(hSession != NULL)
{
REQUEST_CONTEXT* rcContext = new REQUEST_CONTEXT;
if (rcContext)
{
memset(rcContext,0,sizeof(REQUEST_CONTEXT));
rcContext->URL = new wchar_t[256];
rcContext->ReceiveTimeout = 5000;
rcContext->ConnectTimeout = 5000;
rcContext->ResolveTimeout = 5000;
rcContext->SendTimeout = 5000;
rcContext->hSession = hSession;
if (!rcContext->URL)
{
delete rcContext;
WinHttpCloseHandle(hSession);
continue;
}
wcscpy(rcContext->URL,ZC);
char* request = "<?xml version="1.0" encoding="windows-1251"?>"
"<soapenv:Envelope xmlns:env="http: "<soapenv:Header/>"
"<soapenv:Body/>"
"</soapenv:Envelope>";
rcContext->SendBuffer = NULL;
int f = strlen(request);
rcContext->SendBuffer = new char[f+1];
if (rcContext->SendBuffer)
{
memset(rcContext->SendBuffer,0,f+1);
strncpy(rcContext->SendBuffer,request,f);
}
BOOL fRequest = SendRequest(rcContext);
}
}
}
getchar();
printf("CounterGood = %d, CounterBad = %dn",CounterGood,CounterBad);
Sleep(2000);
return 0;
}
|