I'm trying to write my chat client with the ability to accept and hold connections for multiple users. However, I've hit a.. problem.
I want to store the clients in a vector defined as 'vector <SOCKET> Sockets', so that I can use the very nice dynamic resizing to store a potentially infinate number of connections. However, this causes a problem.
1.) How would I go about [when a socket is closed remotely] retrieving WHICH socket in the vector is no longer valid and removing it? I thought about sending dummy data and seeing if the socket returned SOCKET_ERROR, but that doesn't seem to do what I want.
2.) If I wanted to send a message to a particular client (socket), the problem comes up again of retrieving the exact socket's value. I don't even have the /slightest/ idea of how to do this.
Any advice on where to go from here?