my_life

windows:

http://www.cppblog.com/Fox/archive/2009/09/12/95975.html

http://www.cppblog.com/shanoa/archive/2015/03/19/145840.html

 

 

// 2 - 系统找不到指定的文件。 
// 121 - 信号灯超时时间已到。 

// 1450 - 系统资源不足,无法完成请求的服务。 
// 995 - 由于线程退出或应用程序请求,已放弃 I/O 操作。 

// 64 - 指定的网络名不再可用。 
// 10053 - 您的主机中的软件放弃了一个已建立的连接。 
// 10054 - 远程主机强迫关闭了一个现有的连接 
// 10058 - 由于以前的关闭调用,套接字在那个方向已经关闭,发送或接收数据的请求没有被接受。 

// 0 - 操作成功完成。 
// 997 - 重叠 I/O 操作在进行中。 
// 998 - 内存分配访问无效。 (when fread() filesize > 3G) 

 

以下是一部分在async_receive()的handler处捕获到的比较有用的错误码

错误码(十进制) 枚举 发现原因
10009 boost::asio::error::bad_descriptor 在一个已经关闭了的套接字上执行async_receive()
995 boost::asio::error::operation_aborted 正在async_receive()异步任务等待时,本端关闭套接字
10054 boost::asio::error::connection_reset 正在async_receive()异步任务等待时,远端的TCP协议层发送RESET终止链接,暴力关闭套接字。常常发生于远端进程强制关闭时,操作系统释放套接字资源。
2 boost::asio::error::eof 正在async_receive()异步任务等待时,远端关闭套接字,这里跟10054发生的情况似乎一样,但是实际上应该是有区别的,具体神马区别,由回复中jack的说法,这个是远端正常关闭套接字。

 

WSAECONNRESET (10054): Connection reset by peer.

远程主机强迫关闭了一个现有的连接。

MSDN: 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.

 

分类:

技术点:

相关文章:

  • 2021-08-25
  • 2021-11-30
  • 2021-12-14
  • 2021-10-03
  • 2021-08-01
  • 2021-07-24
  • 2021-12-01
  • 2021-10-20
猜你喜欢
  • 2022-12-23
  • 2021-04-28
  • 2022-12-23
  • 2021-12-23
  • 2022-12-23
  • 2021-08-05
  • 2021-08-21
相关资源
相似解决方案