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
不知道要怎么解决求大神指点