recvfrom()取得的返回值是-1,WSAGetLastError()=10054,不知道要怎么解决

顾染尘 2019-11-12 04:42:41
windows7操作系统,在网上查找的方法
#include <Winsock2.h>
#include <Mstcpip.h>
#include <stdio.h>

#pragma comment(lib, "ws2_32.lib")
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR, 12)

int iSock = socket(AF_INET, SOCK_DGRAM, 0);
BOOL bNewBehavior = FALSE;
DWORD dwBytesReturned = 0;
WSAIoctl(iSock, SIO_UDP_CONNRESET, &bNewBehavior, sizeof bNewBehavior, NULL, 0, &dwBytesReturned, NULL, NULL);
编译时产生错误
knUdpSocket.cc
knUdpSocket.cc(24) : error C2501: 'WSAIoctl' : missing storage-class or type specifiers
knUdpSocket.cc(24) : error C2373: 'WSAIoctl' : redefinition; different type modifiers
C:\Program Files\Microsoft Visual Studio\VC98\include\WinSock2.h(2714) : see declaration of 'WSAIoctl'
knUdpSocket.cc(24) : error C2078: too many initializers
不知道要怎么解决求大神指点
...全文
184 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
顾染尘 2019-11-13
  • 打赏
  • 举报
回复
已解决1234567890

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧