Greetings. Now, like others, I plan to have a list active connections.
Like others, I ran into the copying problem. To prevent the socket from being copied, I can use a unique_ptr. The problem is, I cannot figure out how to make this work with an std::pair. It needs to be constructed by either moving or copying, and I cannot do either. Currently I was attempting this:
sockets.push_back(std::make_unique<std::pair<sf::TcpSocket, std::mutex>>(sf::TcpSocket(), std::mutex()));
The mutex was my attempt at making it threadsafe. I plan to, for each client, have a blocking receiver in it's own thread. While this is going on, whenever I want to send a message, I would do it via the same connection. I don't know whether or not that works at the same time.