Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Problems using idHTTP Socket Error #10054



Permlink Replies: 2 - Last Post: Mar 16, 2018 12:28 AM Last Post By: Jeffrey Ottery
Jeffrey Ottery

Posts: 42
Registered: 11/27/05
Problems using idHTTP Socket Error #10054
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 15, 2018 6:53 PM
Using idHTTP to Post to a URL. As Follows;

function PostToURL(URL: String): Boolean;
var Output: TFileStream;
begin
Result:=False;
try
try
Output:=TFileStream.Create('Temp.txt',fmCreate); //just a dummy stream for use in the Post procedure
idHTTP1.Post(URL,Output);
Result:=True;
finally Output.Free; end;
except On E: Exception do ShowMessage(E.Message+#10+URL); end;
end;

When I start the program it works OK for 10 minutes (use it multiple times) BUT after a varying time it throws: Socket Error #10054. Connection reset by peer. (pretty sure it is not an error at the other end)

Then it can't be used until I restart the program

Spent days on this playing with properties etc.

Anyone have some ideas for me.

ALSO is there any documentation for idHTTP as I can't seem to find any.
Jeffrey Ottery

Posts: 42
Registered: 11/27/05
Re: Problems using idHTTP Socket Error #10054
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 15, 2018 10:10 PM   in response to: Jeffrey Ottery in response to: Jeffrey Ottery
Just to let anyone know that I found a workaround on this. just send a dummy idHttp.Post every 10 minutes seems to keep it alive with no errors.
Maybe there is a property that can be set/called to "Keep Alive".???

Jeffrey Ottery wrote:
Using idHTTP to Post to a URL. As Follows;

function PostToURL(URL: String): Boolean;
var Output: TFileStream;
begin
Result:=False;
try
try
Output:=TFileStream.Create('Temp.txt',fmCreate); //just a dummy stream for use in the Post procedure
idHTTP1.Post(URL,Output);
Result:=True;
finally Output.Free; end;
except On E: Exception do ShowMessage(E.Message+#10+URL); end;
end;

When I start the program it works OK for 10 minutes (use it multiple times) BUT after a varying time it throws: Socket Error #10054. Connection reset by peer. (pretty sure it is not an error at the other end)

Then it can't be used until I restart the program

Spent days on this playing with properties etc.

Anyone have some ideas for me.

ALSO is there any documentation for idHTTP as I can't seem to find any.
Jeffrey Ottery

Posts: 42
Registered: 11/27/05
Re: Problems using idHTTP Socket Error #10054
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 16, 2018 12:28 AM   in response to: Jeffrey Ottery in response to: Jeffrey Ottery
OK, Solved my problem.

I was using idHTTP component and it was getting created once at start up.

Now I just create and free idHTTP each time I use it and have had no further issues with it dying/timing out.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02