Idhttp Post appears exception class Eidsocketerror with message ' Socket Error # 10054 ' Workaround (catch exception to prevent the program from hanging off)

Source: Internet
Author: User
Tags socket error connection reset


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
    1. V_sparm:tstringlist;
    2. Begin
    3. result:=' 0 ';
    4. V_sparm: = Tstringlist.  Create;
    5. ......
    6. Form1. IDHTP1.  ConnectTimeout: = 15000;
    7. Form1. IDHTP1.  readtimeout:=15000;
    8. ......
    9. Try
    10. ......
    11. Try
    12. Result:=form1. IDHTP1.  Post (Url,v_sparm);
    13. except
    14. On e:eidexception do //capture Socket Error # 10054 Connection reset by peer with Eidexception
    15. begin
    16. Writelog (e. Message); //Handling exception information.  Prevent the program from hanging out.
    17. end;
    18. end;
    19. finally
    20. end;
    21. 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.