近期使用winSock做的一个网络项目中,使用TCP+Socket连接编写的一个多线程的网络程序,功能是client负责不断地向server端发送数据,服务端负责接收数据。client是一个DLL,服务端程序是一个随机启动的NT Service服务程序。

程序在夜间无人操作的执行过程中,client常常不定时地出现错误号为:10054错误,而server端并没有对应的提示。执行环境是win2000+sp4,这个问题出现得比較莫名其妙。

查了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来配置一个套接字。

最新文章

  1. css3clock.js - 一个用CSS3与纯js实现的简单时钟
  2. jQuery实现瀑布流
  3. Neo4j Index Notes
  4. iOS 基于UIWebView的应用特点
  5. Android 使用AIDL调用外部服务
  6. JQuery(三) Ajax相关
  7. 深入理解Python中的生成器
  8. JSP中 JSTL
  9. linux跨主机复制文件或文件夹
  10. 【转载】 ISO14229系列之二:诊断指令格式和相关概念
  11. Linux上查看用户名和组并把特定用户放到特定的组之下
  12. Tomcat设置cmd窗口的title属性
  13. Linux中断管理
  14. 使用163.com邮箱发送邮件
  15. PythonStudy——赋值运算符 Assignment operator
  16. Inno Setup使用
  17. Docker源码分析(八):Docker Container网络(下)
  18. c# MVC模式学习笔记_数据验证
  19. 【week10】规格说明书练习-吉林市1日游
  20. mysql root用户密码个性

热门文章

  1. C语言小结之链表
  2. WebForm中TreeView的使用
  3. JVM 学习笔记(二)
  4. Hibernate save或者persist 后获取主键ID
  5. VS2005 检测内存泄漏的方法(转载)
  6. InvalidIndexNameException[Invalid index name [2Shard], must be lowercase]
  7. [cocos2d]cocos2d 2.1与ios 6.0
  8. unicode转中文
  9. wcf异常汇总
  10. Learing WCF Chapter1 WCF Services