You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to Layered Service Providers(LSPs), the socket handles are not properly duplicated by calling CreateProcess with bInheritHandles=TRUE. The duplicated handles in the child processes work for some things, but not others. For example AcceptEx on a duplicated listen socket seems to work, but then setsockopt( sAcceptSocket, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char *)&sListenSocket, sizeof(sListenSocket) ); fails making it impossible to call getpeername or any other function not in the list in the AcceptEx remarks section: https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-acceptex#remarks
As we control the source for the parent and child process, it should be possible to use WSADuplicateSocket to properly pass a socket to a child process.
The text was updated successfully, but these errors were encountered:
Due to Layered Service Providers(LSPs), the socket handles are not properly duplicated by calling
CreateProcess
withbInheritHandles=TRUE
. The duplicated handles in the child processes work for some things, but not others. For exampleAcceptEx
on a duplicated listen socket seems to work, but thensetsockopt( sAcceptSocket, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, (char *)&sListenSocket, sizeof(sListenSocket) );
fails making it impossible to callgetpeername
or any other function not in the list in theAcceptEx
remarks section: https://learn.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-acceptex#remarksThe problem with inherited sockets is discussed more here: https://stackoverflow.com/questions/11847793/are-tcp-socket-handles-inheritable
As we control the source for the parent and child process, it should be possible to use
WSADuplicateSocket
to properly pass a socket to a child process.The text was updated successfully, but these errors were encountered: