windows下socket编程GetLastError()函数返回结果与对照表-转
原文地址:http://blog.sina.com.cn/s/blog_4880c4bb0100b6a5.html
WSAGetLastError()函数返回结果与对照表:
Windows Sockets code Error Description
------------------------------------------------------------------------
WSAEINTR 10004 Interrupted system call.系统调用已中断
WSAEBADF 10009 Bad file number.不良档案
WSEACCES 10013 Permission denied.许可被拒绝
WSAEFAULT 10014 Bad address.错误处理
WSAEINVAL 10022 Invalid argument.无效的论点
WSAEMFILE 10024 Too many open files.文件打开太多
WSAEWOULDBLOCK 10035 Operation would block.操作阻塞
WSAEINPROGRESS 10036 Operation now in progress. This error is
returned if any Windows Sockets API
function is called while a blocking
function is in progress.
WSAEALREADY 10037 Operation already in progress.行动已经取得进展
WSAENOTSOCK 10038 Socket operation on nonsocket.套接字操作没有接口
WSAEDESTADDRREQ 10039 Destination address required.需要目标地址
WSAEMSGSIZE 10040 Message too long.
WSAEPROTOTYPE 10041 Protocol wrong type for socket.协议类型错误的接口
WSAENOPROTOOPT 10042 Protocol not available.协议书不存在
WSAEPROTONOSUPPORT 10043 Protocol not supported.不支持的协议
WSAESOCKTNOSUPPORT 10044 Socket type not supported.不支持的接口类型
WSAEOPNOTSUPP 10045 Operation not supported on socket.接口不支持的动作
WSAEPFNOSUPPORT 10046 Protocol family not supported.不支持的协议簇
WSAEAFNOSUPPORT 10047 Address family not supported by protocol
family.
WSAEADDRINUSE 10048 Address already in use.地址已在使用中
WSAEADDRNOTAVAIL 10049 Cannot assign requested address.
WSAENETDOWN 10050 Network is down. This error may be
reported at any time if the Windows
Sockets implementation detects an
underlying failure.
WSAENETUNREACH 10051 Network is unreachable.
WSAENETRESET 10052 Network dropped connection on reset.
WSAECONNABORTED 10053 Software caused connection abort.
WSAECONNRESET 10054 Connection reset by peer.
WSAENOBUFS 10055 No buffer space available.
WSAEISCONN 10056 Socket is already connected.
WSAENOTCONN 10057 Socket is not connected.接口没有连接成功
WSAESHUTDOWN 10058 Cannot send after socket shutdown.接口断开,不能发送
WSAETOOMANYREFS 10059 Too many references: cannot splice.
WSAETIMEDOUT 10060 Connection timed out.
WSAECONNREFUSED 10061 Connection refused.
WSAELOOP 10062 Too many levels of symbolic links.
WSAENAMETOOLONG 10063 File name too long.
WSAEHOSTDOWN 10064 Host is down.
WSAEHOSTUNREACH 10065 No route to host.
WSASYSNOTREADY 10091 Returned by WSAStartup(), indicating that
the network subsystem is unusable.
WSAVERNOTSUPPORTED 10092 Returned by WSAStartup(), indicating that
the Windows Sockets DLL cannot support
this application.
WSANOTINITIALISED 10093 Winsock not initialized. This message is
returned by any function except
WSAStartup(), indicating that a
successful WSAStartup() has not yet been
performed.
WSAEDISCON 10101 Disconnect.
WSAHOST_NOT_FOUND 11001 Host not found. This message indicates
that the key (name, address, and so on)
was not found.——找不到主机。关键(姓名,地址,等等)没有找到。
WSATRY_AGAIN 11002 Nonauthoritative host not found. This
error may suggest that the name service
itself is not functioning.
WSANO_RECOVERY 11003 Nonrecoverable error. This error may
suggest that the name service itself is
not functioning.
WSANO_DATA 11004 Valid name, no data record of requested
type. This error indicates that the key
(name, address, and so on) was not found.
个人总结:
windows下socket编程,socket创建前需要设置WSAStartup();close后,需要WSACleanup(),但是linux下不需要。windows下会报出10093 GetLastError()的错误。
windows下socket编程,
struct sockaddr_in localsin;
memset(&localsin, 0, sizeof(localsin));
localsin.sin_family = AF_INET;
//localsin.sin_addr.s_addr = htonl(localipaddr);//windows下不能设置本地ip,只需要写为0就可以了。但是linux下需要的。
//若设置了本地ip,windows下会报出10049的GetLastError()的错误。
localsin.sin_addr.S_un.S_addr = htonl(0);
windows下socket编程GetLastError()函数返回结果与对照表-转相关推荐
- Linux 下socket编程 connect()函数返回-1(error:Connection refused)
一.背景 系统:CentOS7 64位 物理机 IP:192.168.2.199/24 使用端口:9999 二.问题描述 在tty1上运行服务器程序,在tty2上运行客户端程序 若连接成功,则服务器程 ...
- Windows下Socket编程
Windows下Socket编程 构架 创建socket 绑定bind 存储转换函数 监听listen 接收accept 发送send(tcp)/sendto(udp) 接收recv(tcp)/rec ...
- linux下socket编程读写函数
linux下socket编程,实现服务器与客户端的通信之后,在同一个虚拟机上,打开两个shell,一个运行服务器程序,一个运行客户端程序,课相互发送数据. 如果使用的是recv接收函数,当关闭客户端或 ...
- socket编程accept函数返回值的理解
accept函数返回值成功时返回非负值,失败时返回-1 accept函数接受一个客户端请求后会返回一个新的SOCKFD值,当有不同的客户端同时有不同请求时,会返回不同的SOCKFD的值.这个不同的值和 ...
- Windows下socket编程(console非MFC)
console控制台:使用<winsock2.h> 和 ws2_32.lib 参考:孙鑫C++课程14 TCP:面对连接的.安全的通信 // TcpSrv.cpp /#define _C ...
- windows下linux下socket编程区别
1. 头文件 windows下winsock.h或winsock2.h linux下netinet/in.h(大部分都在这儿),unistd.h(close函数在这儿),sys/socket.h(在i ...
- LINUX下Socket编程 函数格式详解
你需要了解的一些系统调用: socket() bind() connect() listen() accept() send() recv() sendto() recvfrom() close() ...
- linux 创建线程函数吗,[笔记]linux下和windows下的 创建线程函数
linux下和windows下的 创建线程函数 #ifdef __GNUC__ //Linux #include #define CreateThreadEx(tid,threadFun,args) ...
- Linux下Socket编程
Linux下Socket编程 网络的Socket数据传输是一种特殊的I/O,Socket也是一种文件描述符.Socket也具有一个类似于打开文件的函数调用Socket(),该函数返回一个整型的S ...
最新文章
- centos7 php配置,CentOS7 下nginx与PHP的安装与配置
- python导入自定义模块和路径问题
- Spring.Web.Mvc 注入(控制器属性注入)
- 周思进:自知“能力不足“让我专注十几年音视频
- python写一个类方法_python中如何写类
- [转] android自定义布局中的平滑移动
- c++ vector排序_C++ vector动态数组的常见操作
- Power Strings POJ - 2406,字符串hash
- DB2 表字段值变更记录
- 论计算机在化工过程控制中的应用,计算机在化工中的应用论文正稿.doc
- python3 sorted自定义排序的函数
- javaweb超市商品库存信息管理系统报告
- DC-DC buck降压电路 电压电流双闭环PI控制matlab仿真模型
- 蜂房问题-蜜蜂在蜂房中只能向下或者右上方爬,从a位置爬到b位置有多少种途径
- Linux驱动开发-编写(EEPROM)AT24C02驱动
- 麒麟 linux下安装显卡驱动,优麒麟 Linux x64 16.10
- Web负载均衡的几种实现方式
- Redis设计与实现详解二:Redis数据库实现
- intell IDE初始用
- 黑白电影变为彩色电影?这个方法分享给你
热门文章
- dedecms文章页面URL路径优化
- 站长工具:天和流量王绿色版 下载
- 校招真题练习009 配比(京东)
- 大型项目linux自动化版本发布脚本(shell)之tomcat、nginx服务脚本
- Deployment vs ReplicationController in Kubernetes
- collectd 5.7.2 发布,系统监控和统计工具
- 17 行代码实现的简易 Javascript 字符串模板
- android 62 手机存储目录的划分
- 我们正在步入谷歌数据时代
- 热门开源CI/CD解决方案 GoCD 中曝极严重漏洞,可被用于接管服务器并执行任意代码...