Error 12029 WinHTTP
-
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
#include
#include
#pragma comment(lib,"winhttp")// Context value structure.
typedef struct {
HINTERNET hSession; // HTTP Session
HINTERNET hConnect; // Connection handle
HINTERNET hRequest; // Resource request handle
DWORD dwSize; // Size of the latest data block
DWORD dwTotalSize; // Size of the total data
LPSTR lpBuffer; // Buffer for storing read data
char* SendBuffer; // Send buffer
wchar_t* URL; // URL
int Resend; // flag to resend
DWORD SendTimeout; // send timeout
DWORD ReceiveTimeout; // receive timeout
DWORD ConnectTimeout; // connect timeout
DWORD ResolveTimeout; // resolve timeout
bool IsBadRequest; // bad request complete
WINHTTP_STATUS_CALLBACK pCallback; //callback} REQUEST_CONTEXT;
int CounterGood = 0;
int CounterBad = 0;// This macro returns the constant name in a string.
#define CASE_OF(constant) case constant: return (L# constant)LPCWSTR GetApiErrorString(DWORD dwResult)
{
// Return the error result as a string so that the
// name of the function causing the error can be displayed.
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\]; // Set the memo to indicate a closed handle. swprintf(szBuffer,sizeof(szBuffer), L"Cleanup"); //printf("%ws",szBuffer); if (cpContext->hRequest) { swprintf(szBuffer, sizeof(szBuffer), L">WinHttpSetStatusCallback
-
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
#include
#include
#pragma comment(lib,"winhttp")// Context value structure.
typedef struct {
HINTERNET hSession; // HTTP Session
HINTERNET hConnect; // Connection handle
HINTERNET hRequest; // Resource request handle
DWORD dwSize; // Size of the latest data block
DWORD dwTotalSize; // Size of the total data
LPSTR lpBuffer; // Buffer for storing read data
char* SendBuffer; // Send buffer
wchar_t* URL; // URL
int Resend; // flag to resend
DWORD SendTimeout; // send timeout
DWORD ReceiveTimeout; // receive timeout
DWORD ConnectTimeout; // connect timeout
DWORD ResolveTimeout; // resolve timeout
bool IsBadRequest; // bad request complete
WINHTTP_STATUS_CALLBACK pCallback; //callback} REQUEST_CONTEXT;
int CounterGood = 0;
int CounterBad = 0;// This macro returns the constant name in a string.
#define CASE_OF(constant) case constant: return (L# constant)LPCWSTR GetApiErrorString(DWORD dwResult)
{
// Return the error result as a string so that the
// name of the function causing the error can be displayed.
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\]; // Set the memo to indicate a closed handle. swprintf(szBuffer,sizeof(szBuffer), L"Cleanup"); //printf("%ws",szBuffer); if (cpContext->hRequest) { swprintf(szBuffer, sizeof(szBuffer), L">WinHttpSetStatusCallback
-
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
#include
#include
#pragma comment(lib,"winhttp")// Context value structure.
typedef struct {
HINTERNET hSession; // HTTP Session
HINTERNET hConnect; // Connection handle
HINTERNET hRequest; // Resource request handle
DWORD dwSize; // Size of the latest data block
DWORD dwTotalSize; // Size of the total data
LPSTR lpBuffer; // Buffer for storing read data
char* SendBuffer; // Send buffer
wchar_t* URL; // URL
int Resend; // flag to resend
DWORD SendTimeout; // send timeout
DWORD ReceiveTimeout; // receive timeout
DWORD ConnectTimeout; // connect timeout
DWORD ResolveTimeout; // resolve timeout
bool IsBadRequest; // bad request complete
WINHTTP_STATUS_CALLBACK pCallback; //callback} REQUEST_CONTEXT;
int CounterGood = 0;
int CounterBad = 0;// This macro returns the constant name in a string.
#define CASE_OF(constant) case constant: return (L# constant)LPCWSTR GetApiErrorString(DWORD dwResult)
{
// Return the error result as a string so that the
// name of the function causing the error can be displayed.
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\]; // Set the memo to indicate a closed handle. swprintf(szBuffer,sizeof(szBuffer), L"Cleanup"); //printf("%ws",szBuffer); if (cpContext->hRequest) { swprintf(szBuffer, sizeof(szBuffer), L">WinHttpSetStatusCallback
Diprom wrote:
After cyclic sending of n-requests, error 12029 is often generated.
What API call causes this error?
-
Diprom wrote:
After cyclic sending of n-requests, error 12029 is often generated.
What API call causes this error?
-
SendRequest(rcContext);
Although this call always terminates normally. 12029 I catch in the callback AsyncCallbackSendRequest looks like your own function. It calls a lot of WinHTTP functions. So which one of these WinHTTP functions fails with this error?
-
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
#include
#include
#pragma comment(lib,"winhttp")// Context value structure.
typedef struct {
HINTERNET hSession; // HTTP Session
HINTERNET hConnect; // Connection handle
HINTERNET hRequest; // Resource request handle
DWORD dwSize; // Size of the latest data block
DWORD dwTotalSize; // Size of the total data
LPSTR lpBuffer; // Buffer for storing read data
char* SendBuffer; // Send buffer
wchar_t* URL; // URL
int Resend; // flag to resend
DWORD SendTimeout; // send timeout
DWORD ReceiveTimeout; // receive timeout
DWORD ConnectTimeout; // connect timeout
DWORD ResolveTimeout; // resolve timeout
bool IsBadRequest; // bad request complete
WINHTTP_STATUS_CALLBACK pCallback; //callback} REQUEST_CONTEXT;
int CounterGood = 0;
int CounterBad = 0;// This macro returns the constant name in a string.
#define CASE_OF(constant) case constant: return (L# constant)LPCWSTR GetApiErrorString(DWORD dwResult)
{
// Return the error result as a string so that the
// name of the function causing the error can be displayed.
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\]; // Set the memo to indicate a closed handle. swprintf(szBuffer,sizeof(szBuffer), L"Cleanup"); //printf("%ws",szBuffer); if (cpContext->hRequest) { swprintf(szBuffer, sizeof(szBuffer), L">WinHttpSetStatusCallback
Hi,
Diprom wrote:
After cyclic sending of n-requests, error 12029 is often generated.
The Windows operating system limits the number of half-open TCP connections. On the Windows 10 operating system you will be limited to 20 and on the older operating systems it could be as low as 10.
Diprom wrote:
for (int i = 0; i < 2000; i++)
That's alot of asynchronous connections... the Windows operating system will not allow you to make 2000 outgoing connections this fast. Best Wishes, -David Delaune
ScientiƦ de conservata veritate.