+ case FD_READ:
+ // We may get a FD_READ notification even when there is no data
+ // to read on the socket, in particular this happens on socket
+ // creation when we seem to always get FD_CONNECT, FD_WRITE and
+ // FD_READ notifications all at once (but it doesn't happen
+ // only then). Ignore such dummy notifications.
+ {
+ fd_set fds;
+ timeval tv = { 0 };
+
+ wxFD_ZERO(&fds);
+ wxFD_SET(socket->m_fd, &fds);
+
+ if ( select(socket->m_fd + 1, &fds, NULL, NULL, &tv) != 1 )
+ return 0;
+ }
+
+ event = wxSOCKET_INPUT;
+ break;
+
+ case FD_WRITE:
+ event = wxSOCKET_OUTPUT;
+ break;
+
+ case FD_ACCEPT:
+ event = wxSOCKET_CONNECTION;
+ break;
+
+ case FD_CONNECT:
+ event = WSAGETSELECTERROR(lParam) ? wxSOCKET_LOST
+ : wxSOCKET_CONNECTION;
+ break;
+
+ case FD_CLOSE:
+ event = wxSOCKET_LOST;
+ break;
+
+ default:
+ wxFAIL_MSG( "unexpected socket notification" );
+ return 0;