Search code examples
c++socketswinapinetwork-programmingiocp

Can I use accept() with IOCP?


I want to use IOCP to handle hundreds of client connections. Is there's a problem in using accept() to accept these connections, or I should use WSAAccept()?


Solution

  • There should be no problem. But there could be, as the berkley and WSA interfaces weren't supposed to be mixed. I mixed sockets and WSASelect in a project with no problem as the SOCKET handle given back is the same, regardless of which command you used to obtain it.

    But it is IMHO a bad style to mix it where it isn't necessary. So if you already used WSA style, stick to it.

    You should also look at the AcceptEx() function.