I have a hard time to understand this, say we have a really simple server.
It listens on a sf::TcpListener that is added to a sf::TcpSelector.
Every frame it iterates through all of the selectors ready sockets, If the current ready socket equals the selector, it accepts the new connection and adds that socket to the listener.
But how would i manage the clients outside the selector itself?
Say we have a class named Client. Wich contains the clients Socket, and some other data(like Name , Xpos, Ypos etc), And that we have an "std::vector<Client> Clients" that holds the connected clients.
How would i properly add clients to this vector using the same sf::TcpSocket that is accepted and added to the selector? Would the Clients socket be a pointer to the one in the selector? How would i then get a pointer to that socket?
Could someone please help me understand how to do this? Im not looking for someone to code a working example(even if that would be nice), but the knowledge on how to do this myself.
Thanks!