Socket 10054

来源:互联网 发布:mysql数据库语句大全 编辑:程序博客网 时间:2024/06/06 01:35

客户端经常不定时地出现错误号为:10054的错误,而服务器端并没有相应的提示。这个问题出现得比较莫名其妙。

 

查了MSDN上的10054错误号说明:WSAECONNRESET     (10054)   

    

  Connection  reset  by  peer.     

 

A 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, or the remote host used a "hard close" 
(see setsockopt for more  information on the SO_LINGER option on the remote socket.)

 

 也就是说,一个连接被对方重设。一个建立的连接被远程主机强行关闭,若远程主机上的进程异常终止运行(由于内存冲突或硬件故障),或者针对套接字执行了一次强行关闭,便会产生10054错误。针对强行关闭的情况,可用SO_LINGER套接字选项和setsockopt来配置一个套接字。

原创粉丝点击