I am writing a server for chat. Your protocol. Familiar (friend) client writes. There was a question how to organize servicing of several clients.
First option. The eavesdropping of each socket is a separate thread. Hence the question: "How much will it be resource-intensive compared with the second option?"
The second option. 3 threads. The first accepts new connections and adds users for example to the "vector". The second runs through the "vector", taking the data. The third sends in the same way.
I will also accept the advice on the implementation algorithm.