gpt4 book ai didi

c++ - 没有 WSAIoctl 的 AcceptEx

转载 作者:太空狗 更新时间:2023-10-29 23:42:25 24 4
gpt4 key购买 nike

使用AcceptEx直接调用和使用WSAIoctl获取的函数指针有区别吗

MSDN 没有完全涵盖这个关于性能问题的问题以及使用 AcceptEx 作为直接调用可能面临的其他问题。

另一个问题是:例如,如果我的程序中有 4 个监听套接字,我是否需要为每个监听套接字调用 WSAIoctl,当然还需要为每个套接字存储函数指针?或者对任何套接字调用一次就足够了,而不是与其他套接字一起使用。

提前致谢。

最佳答案

Calling the function without previously obtaining a function pointer (that is, by linking with mswsock.lib and calling AcceptEx directly) is costly because AcceptEx sits outside the layered architecture of Winsock2. AcceptEx must request a function pointer using WSAIoctl for every call on the off chance that the application is actually trying to invoke AcceptEx from a provider layered on top of mswsock (see Figure 3). To avoid this significant performance penalty on each call, an application that intends to use these APIs should obtain the pointers to these functions directly from the layered provider by calling WSAIoctl.

来自 http://msdn.microsoft.com/en-us/magazine/cc302334.aspx

关于c++ - 没有 WSAIoctl 的 AcceptEx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4470645/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com