Windows - Wait on event and socket simulatenously
问题 I'm writing Win32-API C code that needs to wait for new TCP connections and on the other side can be closed at any time by any other process/thread. Therefore, I need to somehow WaitForSingleObject on the stop event and wait for connections using WSAAccept simultaneously. I tried WaitForMultipleObjects on both socket and handle but new connection won't trigger the function (also WaitForSingleObject on the socket won't be triggered on a new connection). Any idea? 回答1: You need to use