How best to organize the work of many connection SOCKET as a client?
How to better organize many concurrent connections to the server over the socket
for example to make 10 concurrent connections
and with all the time to work
the server sends us something
we with the data that we sent and the server response
hope I properly explained)
Give the client 10 threads. Each connects to the server. Server-side support for multiple connections is also necessary. The server sees us as separate customers.
But it looks weird.
If the client is single-threaded, it is possible to have a "virtual" connection. Each message is passed through one pair of sockets, but in the message itself, the recorded list of IDs or names of the recipients within the client. For example, if we have a game with multiple units, it does not mean that the action of each unit is transmitted via a separate connection.
You can also split client into separate processes and the exchange between them to organize through local sockets or pipes.