WIN7 VS2012 无法识别DisconnetEx函数
我的系统是win7 64位的,VS2012,
#include <Mswsock.h>
#include <string>
#pragma comment(lib, "Ws2_32.lib")
#pragma comment(lib,"mswsock.lib")
.....................................
使用:
DisconnectEx(sendskt,pOverLapEx->m_OLap,TF_REUSE_SOCKET,0);
居然报错:
DisconnectEx:找不到标识符
弄一个SOCKET池
我想断开SOCKET而不销毁SOCKET,如果DisconnectEx不行,还可以用那个
[解决办法]
这个函数要先加载
MSDN:
Note The function pointer for the DisconnectEx function must be obtained at run time by making a call to the WSAIoctl function with the SIO_GET_EXTENSION_FUNCTION_POINTER opcode specified. The input buffer passed to the WSAIoctl function must contain WSAID_DISCONNECTEX, a globally unique identifier (GUID) whose value identifies the DisconnectEx extension function. On success, the output returned by the WSAIoctl function contains a pointer to the DisconnectEx function. The WSAID_DISCONNECTEX GUID is defined in the Mswsock.h header file.