title: Multithread message send on TCP server
body: <p>I need to make a broadcast of the clients connected to the server using <code>TcpClient</code>. Currently I have a for that goes through the whole list of clients and they receive the message one by one. But there is some time between messages, so the clients do not receive the message simultaneously. I think that using a multithreading or coroutines works, someone can advise me? I attach the function code of the broadcast</p>
  <p>Thank you all</p>
  <pre><code>public void broadCast(string sendMsg)
  {
      foreach (User user in clientList)
      {
          if (user.tcpClient != null)
          {
              m_NetStream = user.tcpClient.GetStream();
  
              if (m_NetStream != null)
              {
                  byte[] msgOut = Encoding.ASCII.GetBytes(sendMsg);
                  m_NetStream.Write(msgOut, 0, msgOut.Length);
              }
              else
              {
                  ServerLog(&quot;Socket Error: Start at least one client first&quot;, Color.red);
                  return;
              }
          }
      }
  }
  </code></pre>