What includes are needed for Winsock Registered I/O? I'm using Windows 10 and Visual Studio Community 2015 Update3
MSDN Winsock Include Files is the only thing I can find and it is very vague.
These are the only Winsock2 includes I can find:
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <MSWSock.h>
#include <WS2spi.h>
#include <WS2atm.h>
#include <ws2def.h>
#include <ws2ipdef.h>
Unfortunately none of them seem to define any RIO functions:
RIOCreateCompletionQueue()
RIOCreateRequestQueue()
//and etc are undefined..
From what I understood starting with Windows 8.1 back in 2012 these functions shipped with the Windows SDK?
Quoting from MSDN:
RIOCreateCompletionQueue function
The function pointer to the
RIOCreateCompletionQueue
function must be obtained at run time by making a call to theWSAIoctl
function with theSIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER
opcode specified. The input buffer passed to theWSAIoctl
function must containWSAID_MULTIPLE_RIO
, a globally unique identifier (GUID) whose value identifies the Winsock registered I/O extension functions. On success, the output returned by theWSAIoctl
function contains a pointer to theRIO_EXTENSION_FUNCTION_TABLE
structure that contains pointers to the Winsock registered I/O extension functions. TheSIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER IOCTL
is defined in theWs2def.h
header file. TheWSAID_MULTIPLE_RIO
GUID is defined in theMswsock.h
header file.
Also take a look at this question. A link from that question references this RIO implementation, containing the following example (excerpt):
...
inline void CreateRIOSocket()
{
g_s = CreateSocket(WSA_FLAG_REGISTERED_IO);
Bind(g_s, PORT);
InitialiseRIO(g_s);
}
inline SOCKET CreateSocket(
const DWORD flags = 0)
{
g_s = ::WSASocket(
AF_INET,
SOCK_DGRAM,
IPPROTO_UDP,
NULL,
0,
flags);
if (g_s == INVALID_SOCKET)
{
ErrorExit("WSASocket");
}
return g_s;
}
inline void InitialiseRIO(
SOCKET s)
{
GUID functionTableId = WSAID_MULTIPLE_RIO;
DWORD dwBytes = 0;
bool ok = true;
if (0 != WSAIoctl(
s,
SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER,
&functionTableId,
sizeof(GUID),
(void**)&g_rio,
sizeof(g_rio),
&dwBytes,
0,
0))
{
ErrorExit("WSAIoctl");
}
}
...