As the title says, I want to use the sf::UdpSocket in blocking mode, but I need to be able to register signals for exit, and as such I also need a way to set the socket to non-blocking mode, so I can return to the function that it's using it.
if( listenerSocket.receive(packet,clientAddress,port) != sf::Socket::Done || exitSignal )
This is the line that's stopping the program. Well, obivously, it's supposed to, since the socket is set to blocking.
So, everything here is fine and dandy.
Now, I'm trying to get another thread to change the socket's blocking mode, so I can close this function.
I tried just calling
listenerSocket.setBlocking(false);
from a different thread, but it doesn't seem to register it until it gets at least 1 packet while still in the blocking mode.
My question is, is there any other way to unblock this socket than just completely killing the thread it's running in?