Due to project needs. You need to submit data to an address. The number of commits is frequent, but the program often raised exception class Eidsocketerror with message ' Socket Error # 10054
Connection reset by Peer. ' Cause the program to be abnormal and stop working.
The following solutions were found. Exception the exception was not caught. You need to use eidexception to catch exceptions.
IDE Environment: Delphi XE3 Version 17.0.4625.53395
Indy:ide comes with.
[Delphi]View PlainCopy
- V_sparm:tstringlist;
- Begin
- result:=' 0 ';
- V_sparm: = Tstringlist. Create;
- ......
- Form1. IDHTP1. ConnectTimeout: = 15000;
- Form1. IDHTP1. readtimeout:=15000;
- ......
- Try
- ......
- Try
- Result:=form1. IDHTP1. Post (Url,v_sparm);
- except
- On e:eidexception do //capture Socket Error # 10054 Connection reset by peer with Eidexception
- begin
- Writelog (e. Message); //Handling exception information. Prevent the program from hanging out.
- end;
- end;
- finally
- end;
- End
http://blog.csdn.net/rznice/article/details/8512321
Idhttp Post appears exception class Eidsocketerror with message ' Socket Error # 10054 ' Workaround (catch exception to prevent the program from hanging off)