What is the purpose of this statement?

21 Views Asked by At

The example provided by Microsoft here:

https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/netds/winsock/iocp/serverex/IocpServerex.Cpp

It is a Winsock server that uses the AcceptEx function with IOCP.

On line 644, there is a statement

lpAcceptSocketContext = UpdateCompletionPort( lpPerSocketContext->pIOContext->SocketAccept, 
                        ClientIoAccept, TRUE);

When the case ClientIoAccept is hit, the new connection has already been accepted, right? Why do we associate this new socket with IOCP using ClientIoAccept again?

Thank you for help.

0

There are 0 best solutions below