WSAErrorString.cpp
上传用户:hyz2004817
上传日期:2022-03-30
资源大小:226k
文件大小:5k
- #include "stdafx.h"
- char ___s[256];
- extern "C" char * WINAPI WSAErrorString( int WSAError )
- {
- switch( WSAError )
- {
- case WSAEACCES: // 10013
- lstrcpy( ___s, "拒绝访问 10013" );
- break;
- case WSAEADDRINUSE: // 10048
- lstrcpy( ___s, "地址已经使用 10048" );
- break;
- case WSAEADDRNOTAVAIL: // 10049
- lstrcpy( ___s, "请求的地址无效 10049" );
- break;
- case WSAEAFNOSUPPORT: // 10047
- lstrcpy( ___s, "地址家族不支持 10047" );
- break;
- case WSAEALREADY: // 10037
- lstrcpy( ___s, "操作已经在进行中 10037" );
- break;
- case WSAECONNABORTED: // 10053
- lstrcpy( ___s, "软件原因连接被中断 10053" );
- break;
- case WSAECONNREFUSED: // 10061
- lstrcpy( ___s, "连接被拒绝 10061" );
- break;
- case WSAECONNRESET: // 10054
- lstrcpy( ___s, "连接被重置 10054" );
- break;
- case WSAEDESTADDRREQ: // 10039
- lstrcpy( ___s, "必须指定目的地址 10039" );
- break;
- case WSAEFAULT:
- lstrcpy( ___s, "地址错误 10014" );
- break;
- case WSAEHOSTDOWN:
- lstrcpy( ___s, "远程主机死机了( 蓝屏?) 10064" );
- break;
- case WSAEHOSTUNREACH:
- lstrcpy( ___s, "无法找到主机 10065" );
- break;
- case WSAEINPROGRESS:
- lstrcpy( ___s, "阻塞操作正在进行 10036" );
- break;
- case WSAEINTR:
- lstrcpy( ___s, "阻塞操作被打断 10004" );
- break;
- case WSAEINVAL:
- lstrcpy( ___s, "参数无效 10022" );
- break;
- case WSAEISCONN:
- lstrcpy( ___s, "套接字已经连接 10056" );
- break;
- case WSAEMFILE:
- lstrcpy( ___s, "打开的套接字太多 10024" );
- break;
- case WSAEMSGSIZE:
- lstrcpy( ___s, "消息太长 10040" );
- break;
- case WSAENETDOWN:
- lstrcpy( ___s, "网络系统, 网络接口, 本地网络有错误 10050" );
- break;
- case WSAENETRESET:
- lstrcpy( ___s, "保持活动的连接在操作中出现错误 10052" );
- break;
- case WSAENETUNREACH:
- lstrcpy( ___s, "网络无法到达 10051" );
- break;
- case WSAENOBUFS:
- lstrcpy( ___s, "没有可用的缓冲区 10055" );
- break;
- case WSAENOPROTOOPT:
- lstrcpy( ___s, "错误的协议选项 10042" );
- break;
- case WSAENOTCONN:
- lstrcpy( ___s, "套接字没有连接 10057" );
- break;
- case WSAENOTSOCK:
- lstrcpy( ___s, "套接字句柄无效 10038" );
- break;
- case WSAEOPNOTSUPP:
- lstrcpy( ___s, "操作不支持 10045" );
- break;
- case WSAEPFNOSUPPORT:
- lstrcpy( ___s, "协议族不支持 10046" );
- break;
- case WSAEPROCLIM:
- lstrcpy( ___s, "使用 WinSock 的进程太多 10067" );
- break;
- case WSAEPROTONOSUPPORT:
- lstrcpy( ___s, "协议不支持 10043" );
- break;
- case WSAEPROTOTYPE:
- lstrcpy( ___s, "协议类型错误 10041" );
- break;
- case WSAESHUTDOWN:
- lstrcpy( ___s, "套接字关闭后无法进行发送操作 10058" );
- break;
- case WSAESOCKTNOSUPPORT:
- lstrcpy( ___s, "套接字类型不支持 10044" );
- break;
- case WSAETIMEDOUT:
- lstrcpy( ___s, "连接超时 10060" );
- break;
- case WSATYPE_NOT_FOUND:
- lstrcpy( ___s, "指定的类没有发现 10109" );
- break;
- case WSAEWOULDBLOCK:
- lstrcpy( ___s, "资源暂时无法获得 10035" );
- break;
- case WSAHOST_NOT_FOUND:
- lstrcpy( ___s, "主机没有发现 11001" );
- break;
- case WSA_INVALID_HANDLE:
- lstrcpy( ___s, "无效句柄 (OS dependent)" );
- break;
- case WSA_INVALID_PARAMETER:
- lstrcpy( ___s, "无效参数 (OS dependent)" );
- break;
- // case WSAINVALIDPROCTABLE:
- // lstrcpy( ___s, "无效的过程表 (OS dependent)" );
- // break;
- // case WSAINVALIDPROVIDER:
- // lstrcpy( ___s, "无效的提供者版本 (OS dependent)" );
- // break;
- case WSA_IO_INCOMPLETE:
- lstrcpy( ___s, "重叠 I/O 事件对象不在通知状态 (OS dependent)" );
- break;
- case WSA_IO_PENDING:
- lstrcpy( ___s, "重叠操作将在过后完成 (OS dependent)" );
- break;
- case WSA_NOT_ENOUGH_MEMORY:
- lstrcpy( ___s, "内存不足 (OS dependent) " );
- break;
- case WSANOTINITIALISED:
- lstrcpy( ___s, "WSAStartup 函数没有成功的调用 10093" );
- break;
- case WSANO_DATA:
- lstrcpy( ___s, "请求的名字有效, 但没有请求的数据记录 11004" );
- break;
- case WSANO_RECOVERY:
- lstrcpy( ___s, "无法回复错误, 可能服务器数据库文件没有发现,也可能是服务器返回了错误 11003" );
- break;
- // case WSAPROVIDERFAILEDINIT:
- // lstrcpy( ___s, "无法初始化服务提供者 (OS dependent)" );
- // break;
- case WSASYSCALLFAILURE:
- lstrcpy( ___s, "系统调用失败 (OS dependent)" );
- break;
- case WSASYSNOTREADY:
- lstrcpy( ___s, "网络子系统错误 10091" );
- break;
- case WSATRY_AGAIN:
- lstrcpy( ___s, "Nonauthoritative host not found. please try again later 11002" );
- break;
- case WSAVERNOTSUPPORTED:
- lstrcpy( ___s, "请求的版本不支持 10092" );
- break;
- case WSAEDISCON:
- lstrcpy( ___s, "从容关闭正在进行中 10101" );
- break;
- case WSA_OPERATION_ABORTED:
- lstrcpy( ___s, "重叠操作被中断 (OS dependent)" );
- break;
- default:
- lstrcpy( ___s, "未知错误" );
- }
- return ___s;
- }