1. Winsock 错误代码
表格摘录:
Windows Sockets错误码 | Berkeley 对应错误码 | 错误号 | 解 释 |
WSAEINTR | EINTR | 10004 | 同标准C |
WSAEBADF | EBADF | 10009 | 同标准C |
WSAEACCES | EACCES | 10013 | 同标准C |
WSAEFAULT | EFAULT | 10014 | 同标准C |
WSAEINVAL | EINVAL | 10022 | 同标准C |
WSAEMFILE | EMFILE | 10024 | 同标准C |
WSAEWOULDBLOCK | EWOULDBLOCK | 10035 | 同BSD |
WSAEINPROGRESS | EINPROGRESS | 10036 | 当一个阻塞函数正在进行时,调用任何Windows Sockets API函数均返回此错误 |
WSAEALREADY | EALREADY | 10037 | 同BSD |
WSAENOTSOCK | ENOTSOCK | 10038 | 同BSD |
WSAEDESTADDRREQ | EDESTADDRREQ | 10039 | 同BSD |
WSAEMSGSIZE | EMSGSIZE | 10040 | 同BSD |
WSAEPROTOTYPE | EPROTOTYPE | 10041 | 同BSD |
WSAENOPROTOOPT | ENOPROTOOPT | 10042 | 同BSD |
WSAEPROTONOSUPPORT | EPROTONOSUPPORT | 10043 | 同BSD |
WSAESOCKTNOSUPPORT | ESOCKTNOSUPPORT | 10044 | 同BSD |
WSAEOPNOTSUPP | EOPNOTSUPP | 10045 | 同BSD |
WSAEPFNOSUPPORT | EPFNOSUPPORT | 10046 | 同BSD |
WSAEAFNOSUPPORT | EAFNOSUPPORT | 10047 | 同BSD |
WSAEADDRINUSE | EADDRINUSE | 10048 | 同BSD |
WSAEADDRNOTAVAIL | EADDRNOTAVAIL | 10049 | 同BSD |
WSAENETDOWN | ENETDOWN | 10050 | 同BSD。任何时候只要Windows Sockets实现检测到网络子系统失败,它就报告此错误。 |
WSAENETUNREACH | ENETUNREACH | 10051 | 同BSD |
WSAENETRESET | ENETRESET | 10052 | 同BSD |
WSAECONNABORTED | ECONNABORTED | 10053 | 同BSD |
WSAECONNRESET | ECONNRESET | 10054 | 同BSD |
WSAENOBUFS | ENOBUFS | 10055 | 同BSD |
WSAEISCONN | EISCONN | 10056 | 同BSD |
WSAENOTCONN | ENOTCONN | 10057 | 同BSD |
WSAESHUTDOWN | ESHUTDOWN | 10058 | 同BSD |
WSAETOOMANYREFS | ETOOMANYREFS | 10059 | 同BSD |
WSAETIMEDOUT | ETIMEDOUT | 10060 | 同BSD |
WSAECONNREFUSED | ECONNREFUSED | 10061 | 同BSD |
WSAELOOP | ELOOP | 10062 | 同BSD |
WSAENAMETOOLONG | ENAMETOOLONG | 10063 | 同BSD |
WSAEHOSTDOWN | EHOSTDOWN | 10064 | 同BSD |
WSAEHOSTUNREACH | EHOSTUNREACH | 10065 | 同BSD |
WSASYSNOTREADY | 10091 | 由WSAStartup() 返回,指示网络子系统无法使用。 | |
WSAVERNOTSUPPORTED | 10092 | 由WSAStartup() 返回,指示Windows Sockets DLL 不能支持此应用程序。 | |
WSANOTINITIALISED | 10093 | 由除WSAStartup()之外的其它函数返回,指示 尚没有一次成功的WSAStartup() 调用执行过。 | |
WSAEDISCON | 10101 | 由WSARecv()和WSARecvFrom()返回,指示远程方已经初始化了一个“雅致”的shutdown序列。 | |
WSAHOST_NOT_FOUND | HOST_NOT_FOUND | 11001 | 同BSD |
WSATRY_AGAIN | TRY_AGAIN | 11002 | 同BSD |
WSANO_RECOVERY | NO_RECOVERY | 11003 | 同BSD |
WSANO_DATA | NO_DATA | 11004 | 同BSD |
3. 关于Winsock error number: 10053 WSAECONNABORTED 的几种不同解释
部分摘录:
Berkeley description: A connection abort was caused internal to your host machine. The software caused a connection abort because there is no space on the socket's queue and the socket cannot receive further connections.
WinSock description: Partly the same as Berkeley. The error can occur when the local network system aborts a connection. This would occur if WinSock aborts an established connection after data retransmission fails (receiver never acknowledges data sent on a datastream socket).
TCP/IP scenario: A connection will timeout if the local system doesn't receive an (ACK)nowledgement for data sent. It would also timeout if a (FIN)ish TCP packet is not ACK'd (and even if the FIN is ACK'd, it will eventually timeout if a FIN is not returned).