Ii have a server in c (winsock) for multiple connections using ThreadCreate() and i store all the new client sockets in an array. Handle peers[10]. By now when i receive data from 1 peer i only loop throug the array and send the data on every socket. But now i face 2 problems
when a new peer connects i just count up an integer, but when it closes the connection i must reorder the HANDLE array to not get over MAX_CONNECTIONS very early
When (later on) i want send data to a specific socket i need something like a numbering system
My questions:
What is the best way to solve problem 1? the ordering when connections starts/stops
Is it ok to just associate every peer with an integer and select it based on that or maybe its ip?
Thanks