title: c++ communicate with specific client Boost asio
body: <p>I'm new to c++ and I started to code my server with boost. I follow a lot of example on the web and on the official doc. But i found nothing (maybe I don't ask the good question) about this-> communicate with a specific client. By this I mean that-></p>
  
  <p><strong>old question:</strong></p>
  
  <blockquote>
    <p>Server launch and wait for connection-> client(1) connect through
    TCP-> server accept client and start async_read</p>
    
    <p>Let's say 3 clients also connect-></p>
    
    <p>How I'll tell to my server too write too client(2) or (3) but not
    both?</p>
  </blockquote>
  
  <p><em>I express myself badly</em></p>
  
  <p><strong>New question:</strong></p>
  
  <p>My server work fine, when client send data to server (custom client in Unreal engine 4) he can read it then write back to my client with no problem. I search a way to speak to the client I want without needed him to send data. Example:</p>
  
  <p>client 1 write to server-> the data send to server launch the next action-> write to a specific client.</p>
  
  <p>More specific example:</p>
  
  <p>Client 1 want to send request to client 10, so client 1 write to the server the action «action, id client» (request, 10) then the server know that he need to talk to the client 10 and send request.</p>
  
  <p>My problem is not on the client side, but on the server side.</p>
  
  <p>I'm sure it's pretty easy and I just don't understand some basic stuff, if someone could provide me a direction, an example or simply an explanation it would be appreciated. Thanks for future answer.</p>
  
  <p>EDIT: </p>
  
  <p>If somebody have hard time like me (I know it's easy but we never know :p, maybe it could help someone) here the answer.</p>
  
  <p>I include this inside the file where I use to connect, write, send, etc.</p>
  
  <pre><code>std::map&lt;int, tcp::socket&gt; playerRemote;
  </code></pre>
  
  <p>I set it-></p>
  
  <pre><code>playerRemote.insert(std::pair&lt;int, tcp::socket&gt;(id, std::move(socket_)));
  </code></pre>
  
  <p>use the socket-></p>
  
  <pre><code>boost::asio::async_read(playerRemote.at(id_to_use)
  </code></pre>
  
  <p>Question resolve! thanks for help!</p>