cpprestsdk
cpprestsdk copied to clipboard
cpprest gets hung after 4 or 5 consecutive requests
pplx::taskweb::http::http_response request_task = client.request(request);
try
{
web_response = request_task.get();
result = true;
}
catch (const std::exception& ex)
{
string_t errorMessage;
ErrorMsg = L"Can't reach the confighub agent. " + utility::conversions::to_string_t(ex.what());
}
catch (...)
{
return result;
}
Tried debugging and could see **web_response = request_task.get();** gets hung . There is no server side issue.
I have tried using wait/get on the task and it was not recommended as per below link so have removed it.
[ https://github.com/microsoft/cpprestsdk/issues/1170]
If i had to wait for some response and perform further steps only after the request is completed, then what to do in that case . Also many cpprest blogs demonstrate to wait on the request object.
https://mariusbancila.ro/blog/2017/11/19/revisited-full-fledged-client-server-example-with-c-rest-sdk-2-10/
Below is my code snippet and it seems to work for first few requests and then hangs and it retrieves after few minutes . I dnt have access to server side code and seems server side code is there for many years. I am just writing the client side code
pplx::task<web::http::http_response> request_task = client.request(request);
try
{
web_response = request_task.get();
result = true;
}
catch (const std::exception& ex)
{
string_t errorMessage;
ErrorMsg = L"Can't reach the confighub agent. " + utility::conversions::to_string_t(ex.what());
}
catch (...)
{
return result;
}
@garethsb can you pls tell you changed the code at client side or server side.