Home > Back-end >  Delphi2010 multithreaded post
Delphi2010 multithreaded post

Time:11-15

Multithreaded post 10054 connection reset by peer is often out of this or read timed out how this broken ah helpless ah
While not Terminated do
The begin
Try
Try
If IdHttp_A. Connected then IdHttp_A. Disconnect;
If not IdHttp_A. Connected then
IdHttp_A:=TIdHTTP. Create (nil);

ResponseStr:=IdHttp_A. Post (formatString, tmp_string);
Except,
On e: the Exception do
The begin
Showmessage ()
End
End
The finally
IdHttp_A. Disconnect;
IdHttp. Free;


End
Online methods are tried all sorts of problems

CodePudding user response:

This should be caused the server, such as do the CC or concurrent beyond server request load, rejection,
In circulation plus sleep (n), n according to the need to adjust;

CodePudding user response:

Your IP access too frequent, the server Settings, actively refused,
If the access frequency, if yao get more IP IP spread out,

CodePudding user response:

You have to have a process scheduling manager.
Simple idea:
1. Before you POST sent tMNG for
2. TMNG view is in the POST number of threads, and the last POST time, if time interval is not enough, return to wait state words
3. The registration of tMNG thread starts
4. After completion of POST, to tMNG signal completed
5. TMNG thread to complete registration

CodePudding user response:

Try
IdHttp_A:=TIdHTTP. Create (nil);
IdHttp_A. HandleRedirects:=True;
IdHttp_A. ConnectTimeout:=3000;
//parameter Settings...
While not Terminated do
Try
If IdHttp_A. Connected then IdHttp_A. Disconnect;
Sleep (100);
ResponseStr:=IdHttp_A. Post (formatString, tmp_string);
//...
Except,
Raise;
//...
end;
The finally
If Assigned (IdHttp_A) then IdHttp_A. Free;
end;

CodePudding user response:

10054, kicked out of the server, want to adjust the access strategy,
  • Related