سؤال

The MSDN page for WriteFileEx says that it can not be used in IOCP model because it has an argument to specify the completion routine. If the file handle has been associated with an I/O completion port, then WriteFileEx will fail.

However, WSASend allows the caller to specify a completion routine as its last argument, while this function can be used in IOCP model.

I examined several examples of WinSock with IOCP, and found the last argument lpCompletionRoutine is always null. Is this mandatory?

هل كانت مفيدة؟

المحلول

The only thing the documentation says is:

The completion routine follows the same rules as stipulated for Windows file I/O completion routines.

That might suggest that you cannot mix IOCP and lpCompletionRoutine together, like with WriteFileEx(). On the other hand, why would you want to mix them together in the first place? Either the completion port gets the result, or the completion routine does. Why would you need to use both?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top