服务器端(TServerSocket)出现10053,10054错误怎么办
客户端:
void __fastcall TForm1::Button3Click(TObject *Sender)//退出
{
logoutSend=IntToStr(nklen)+MyName+"@logout@";
ClientSocket1->Socket->SendText(logoutSend);
ClientSocket1->Close();
}
服务器端:
if(SubData1=="@logout@")//如果收到的是退出的信息,则向在线用户发送用户退出信息
{
m=ServerSocket1->Socket->ActiveConnections;
for(i=0;i<m;i++)
{ServerSocket1->Socket->Connections[i]->SendText(用户退出信息);}
}
为什么有时候退出是服务器端会出现10053和10054错误,有时不会?是哪里的问题?要怎么正确退出?
附(10053。10054错误原因):
WSAECONNABORTED 10053
Software caused connection abort.
An established connection was aborted by the software in your host computer, possibly due to a data transmission time-out or protocol error.
WSAECONNRESET 10054
Connection reset by peer.
An existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket). This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.