Q:

Detecting connection requests without looping

I need to implement some kind of server which first waits for users to connect. I use C++ and SDL_Net, and my code currently checks socket activity in a loop. The problem is that is consumes a lot of CPU performance doing nothing actually, so I'm wondering if there's a way to detect connection request/socket activity with an event or some kind of callback registration? I'm not afraid of WinAPI so any solution is welcome.
Thank you in advance,
Vincent

A:

You can use an SDLNet_SocketSet, create one, then check with SDLNet_CheckSockets and SDLNet_SocketReady

