title: How does dedicated Server notifies Cliens about each other in p2p (TCP)
body: <p>I am learning about network programming and I want to create a simple P2P network based on TCP connection.</p>
  
  <p>So far I have a server that accepts connections from clients (TCP). Clients know about server's initial location. </p>
  
  <p>These are my questions:</p>
  
  <ol>
  <li><p>How can server notify clients about each other? is it the matter of simply sending a list of every bodies IP addresses to everybody ?</p></li>
  <li><p>If all clients are running on the same machine (eg 127.0.0.1), do they need to use a different port number when connecting between each other ? </p></li>
  <li><p>If I want to maintain a TCP connection, how do peers decide who is going to be a client and who is a server in each pair? Perhaps this can be done on server side when he is sending off information out to clients. </p></li>
  </ol>
  
  <p>I assume that TCP connection is not ideal in this scenario, at least for the reason that clients have to maintain a separate connection for each peer in a network. Although this is more of a training exercise and I looking for a reliable connection, where I don't have to deal with possibility of some packets been lost/out of order. (at this stage:).</p>
  
  <p>Thank you!</p>