I am a server. I need to accept many connections. I want to accept a connection, start servicing it and loop back up and repeat.
I have used the following logic but it does not seem to work as intended.
listenSocket = WSASocket(AF_INET, DEFAULT_PROTO, 0, NULL, 0, dwFlags);
bind(listenSocket, (struct sockaddr*)&local, sizeof(local);
eventObject = WSACreateEvent();
WSAEventSelect( listenSocket, eventObject, FD_ACCEPT );
WSAWaitForMultipleEvents( 1, &eventObject, FALSE, WSA_INFINITE, FALSE );
socket = WSAAccept(listenSocket, (struct sockaddr *)&from, &fromlen, conditionFunc, 0); // conditionFunc returns CF_ACCEPT
.... process socket here ....