Q:

Boost ASIO TCP server architecture

Im new to either boost and asio (but not to network programming) and Im currently trying to create a TCP server accepting multiple clients.
The primary functionnality of the server with clients is simple :
1- Read a Header with a fixed size;
2- Interpret what kind of request it is, read the rest of the packet;
3- Handle request with all the data;
4- Going back to step 1.
This is working with basic requests like : Checking Credentials, Enabling a FTP protocol, etc...
But there is a problem :
One request demands to communicate with another connected client through the server.
But, if I follow the Boost Asio architecture given in this example of the Boost website
Or the one in this conference
I don't actually have access to the other clients socket, they are not stocked, they live thanks to the behaviour of smart pointers.
I indeed have a solution for this problem, its to keep the connected sockets in list, and to share it with every connected socket, so at every time the client can access to other clients socket.
But I really think that this is not a good architecure, and that it could be better.
Is there any known way to resolve this problem ?

A:

Here is a good approach:

server keeps socket list for all connected clients
each client receives an ID (string or int) that can be easily sent across the network
client with ID "1" sends to server a message for client with ID "2"
server receives message from "1" and uses the stored socket to send to "2"

This way only the server keeps the sockets. And all clients uses IDs to identify one another.

