The exception message is
Code: Select all
Project Project1.exe raised exception class Exception with message 'Error on data reading from the connection:
An existing connection was forcibly closed by the remote host'.
Code: Select all
void __fastcall TMyProject::Get(String AUrl, TStringStream *&AResponseContent)
{
try
{
TScHttpWebRequest *Request = new TScHttpWebRequest(AUrl);
try
{
Request->UserAgent = this->UserAgent;
Request->Method = rmGET;
Request->ConnectionGroupName = "my_group_name";
TScHttpWebResponse *Response = Request->GetResponse();
try
{
Response->ReadToStream(AResponseContent);
}
__finally
{
Response->Free();
}
}
__finally
{
Request->Free();
}
}
catch (HttpException &exception)
{
// nothing is fetched here
}
catch (Exception &exception)
{
if(exception.Message.Pos("An existing connection was forcibly closed by the remote host") > 1)
{
this->Get(AUrl, AResponseContent);
}
}
}
// ---------------------------------------------------------------------------