As we all know, the tcplistener, while accepting new sockets, go into a long wait mode.
I've gotten around this using sf::Thread, allowing me to work while the thread continuously acquire more clients.
Problem is, when I'm done with the app, I am unable to close the app properly because the other thread is still running.(thread.wait() with sfml's sf::thread and thread.join with std::thread)
What could I do to forcefully close a listen operation?
If not close it, how would I go around not allowing it to accept sockets when in fact, I may still be including more clients.
Say for example, a 12 player game that allows players to join and leave the game whenever they feel.
It would be easier to just queue up 12 players, then start with the network no longer listening for players connecting, but that isn't the path that I am designing. Any ideas?
I am still trying non-blocking, but am receiving random behavior (sometimes it'll stop at accepting, other times, not), will update if I figure it out.
Edit:
Ha.. just thought of something funny, maybe I can attempt to reconnect to it, allowing it to pass the accepting socket stage (of course my socket would be thrown away since I am already registered) and thus allowing it to complete the cycle, and exiting the loop due to running = false. Trying it.
Edit 2:
Solved, I was able to exit the listener and program by attempting a final connection to the server, allowing it to pass the listening method and complete the loop, joining up with main, then exiting. Strange approach, but it works.