Hello everyone!
Been programming with SFML for about a month now, but this is my first problem (which is most likely to be trivial).
I am not using a selector as I want to keep to a structure which has been previously planned, I have turned to sockets into nonblocking and every 'game loop' it checks for a new connection:
sf::IPAddress ConnectionAddress;
sf::SocketTCP Connection;
if (ServerSocket.Accept(Connection,&ConnectionAddress) == sf::Socket::Done)
{
I have a:
sf::SocketTCP ServerSocket
Which is effectively the listener so when a new connection is 'Done' see above.
To store the client connections I have a vector which contains this:
sf::IPAddress Address;
sf::SocketTCP Connection;
Which is inherited from the new connection function. (It also contains various other data connected to the client but that is not relevant).
My problem is when the server gets a new connection it works fine and appears to be 'Done' and the client is processed into the vector. But when a second Client connects it doesn't notice it, until the first disconnects.
What might be holding me back is the theory of how SFML works as this structure should work in my eyes? What am I misinterpreting.
Thanks in advance!
Will,