Windows注册I/O Win 8.1 RioCreateRequestQueue错误10045
Windows Registered I/O Win 8.1 RioCreateRequestQueue Error 10045
使用Win8.1和Visual Studio 2013,我测试了我能找到的每一个Windows注册I/O示例(大约5个)。所有这些都会导致RioCreateRequestQueue()上出现错误10045,如下所示。
c:>rioServerTest.exe
InitialiseRio Start
InitialiseRio End
CreateCompletionQueue Start
CreateCompletionQueue End
CreateRequestQueue start
RIOCreateRequestQueue Error: 10045
相关代码为:
void *pContext = 0;
printf("CreateRequestQueue startn");
g_requestQueue = g_rio.RIOCreateRequestQueue(
g_socket, // Socket
(ULONG) 10, // MaxOutstandingReceive,
(ULONG) 1, // maxReceiveDataBuffers,
(ULONG) 10, // MaxOutstandingSend,
(ULONG) 1, // MaxSendDataBuffers
g_completionQueue, // ReceiveCQ
g_completionQueue, // SendCQ
pContext); // SocketContect
if (g_requestQueue == RIO_INVALID_RQ) {
printf_s("RIOCreateRequestQueue Error: %dn", GetLastError());
exit(1);
}
printf("CreateRequestQueue Endn");
根据我阅读的文献,注册I/O适用于Windows 8及更高版本和Windows Server 2012及更高级别。
有人能通过一个例子向我解释如何在Win8.1上运行吗?TIA
10045是WSAEOPNOTSUPP
,其描述为"不支持操作"。引用的对象类型不支持尝试的操作。通常,当无法支持此操作的套接字的套接字描述符试图接受数据报套接字上的连接时,就会发生这种情况。"
所以实际上,我们需要看到的代码很可能就是您创建套接字的地方。
您的套接字创建代码应该如下所示:
socket = ::WSASocket(
AF_INET,
SOCK_DGRAM,
IPPROTO_UDP,
NULL,
0,
WSA_FLAG_REGISTERED_IO);
我在这里有一些示例文章(包括一整套RIO、UDP服务器设计和完整的源代码),所有这些都在RIO支持的所有操作系统上运行。
相关文章:
- 没有找到相关文章