I have a software which is working faultlessly for 2 years now. This software connects to our remote server every 5 days to check for version updates as well as users license status.
But from yesterday it has suddenly started giving an error when connecting with our remote server. Again the confusing thing is that the error keeps on changing. Most of the time the error is:
Connection Closed Gracefully.
But sometimes another error is also reported, which is:
Socket Error # 10054
Connection reset by peer.
Here is the code that I am using:
Http := TIdHTTP.Create(nil); //Create HTTP Object
Http.Request.UserAgent := 'Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0';
Http.ReadTimeout := -1;
Http.HandleRedirects := True;
Response := TStringStream.Create();
Params := TStringStream.Create('', TEncoding.UTF8, False);
Params.WriteString(Format('data=%s', [TNetEncoding.URL.Encode(JsonData)]));
Http.Request.ContentType := 'application/x-www-form-urlencoded';
try
Http.Post(Url, Params, Response); //the moment this line is executed it triggers Error exception
except on E: Exception do
ShowMessage(E.Message);
end;
Any ideas as to how to solve this problem? I am using Indy 10.6.2.5366 and Delphi Rio 10.3.