title: WSAWaitForMultipleEvents and NetworkEvents
body: <p>I'm trying to get FD_CLOSE event (c++) by WSAWaitForMulipleObjects. in the WSASelectEvent I've set only the FD_CLOSE. however, the wait return, and the network enumaration also return 0, but NetworkEvents return 0 from the enumaration so I can't see FD_CLOSE in it.</p>
  
  <p>Any help?</p>
  
  <p>thanks.</p>
  
  <pre><code>void EventThread(void* obj)
  {
  
      WSANETWORKEVENTS NetworkEvents;
  
      WSAEVENT EventArray[WSA_MAXIMUM_WAIT_EVENTS];
      DWORD EventTotal = 0; 
      EventArray[EventTotal] = WSACreateEvent();
      EventTotal++;
      int res;
      int index;
      if(WSAEventSelect(_socket, EventArray[EventTotal - 1], FD_CLOSE)==SOCKET_ERROR)
          Logger::GetInstance() &lt;&lt; "WSAEventSelect failed with error " &lt;&lt; WSAGetLastError() &lt;&lt; endl;
  
      bool bResult;
      while(true)
      {
          if((index = WSAWaitForMultipleEvents(EventTotal, EventArray, FALSE, WSA_INFINITE, FALSE))==WSA_WAIT_FAILED)
          {
              Logger::GetInstance() &lt;&lt; "WSAWaitForMultipleEvents failed with error " &lt;&lt; WSAGetLastError() &lt;&lt; endl;
          }
  
  
           if ((index != WSA_WAIT_FAILED) &amp;&amp; (index != WSA_WAIT_TIMEOUT)) {
              res = WSAEnumNetworkEvents(_socket, EventArray[index - WSA_WAIT_EVENT_0], &amp;NetworkEvents) ;
  
              if(NetworkEvents.lNetworkEvents &amp; FD_CLOSE)
              {
                  if(NetworkEvents.iErrorCode[FD_CLOSE_BIT] !=0)
                  {
                      Logger::GetInstance() &lt;&lt; "FD_CLOSE failed with error " &lt;&lt; NetworkEvents.iErrorCode[FD_CLOSE_BIT] &lt;&lt; endl;
                  }
                  else
                  {
                      Logger::GetInstance() &lt;&lt; "FD_CLOSE is OK!!! " &lt;&lt; NetworkEvents.iErrorCode[FD_CLOSE_BIT] &lt;&lt; endl;
                  }
              }
           }
  
  
      }
  
  }
  </code></pre>