A solution for asynchronous socket error 10053 error reported by Delphi Communication

Source: Internet
Author: User
Tags socket error

When tclientsocket and tserversocket in Delphi are used for communication programming, the client using tclientsocket uses tclientsocket. when you close the connection and exit the program, the server that uses tserversocket sometimes reports the 'asynchronous socket error 10053 'error. Check the error Description: Software caused connection abort. (The connection is terminated due to software reasons ). The reason is that it is very bad, because you still cannot determine which part of the problem has occurred.

In fact, the cause of this error is that tclientsocket is directly dropped to free without the connection between the client and the server. There are two solutions here (in fact, they are one, but the solution is different. The connection is disconnected)

I. Call tclientsocket before calling the close function of tclientsocket. socket. close will disconnect the connection, but this also has another problem, that is, the server still reports the asynchronous socket error 10053 error, so the tclientsocket is called. socket. you can call tclientsocket again before closing. socket. receivetext receives the data sent by the server completely

2. Add the following code to the onclienterror event on the server:

Case errorcode
10053: Socket. close;
End;

Errorcode: = 0;

Disconnect and set errorcode to 0. If this parameter is not set, asynchronous socket error 10053 is reported even though the error code is still 10053.

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.