title: C++ - UDP server with multiple clients
body: <p>I'm learning the sockets. I am writing a simple UDP server, through which small messages are sent. All active clients send "keepalive" messages every three minutes so that the server can see which clients are online.</p>
  
  <p>These messages are received in the stream</p>
  
  <p>Stream function:</p>
  
  <pre><code>void keepAlive(SOCKET udp)
  {
  int len=0;
  while(true)
  {
   int len=recvfrom(udp,requestBuffer,maxMessage,0,(sockaddr*)&amp;cliAddr,&amp;cliAddrSize)
  // Actions with the received message
  }
  }
  </code></pre>
  
  <p>But how to implement, for example, the transmission of messages to all clients or a specific one, if the socket is already "busy". Need to create a new socket to send messages? (On the server and on the client)?  And if the clients are behind NAT? </p>
  
  <p>The same question is also on the client's side (because keepalive is taken out to the thread, but when solving this problem, the other is being solved too)</p>