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.