title: How to set up TcpListener to always listen and accept multiple connections?
body: <p>This is my Server App:</p>
  <pre><code>public static void Main()
  {
      try
      {
          IPAddress ipAddress = IPAddress.Parse(&quot;127.0.0.1&quot;);
  
          Console.WriteLine(&quot;Starting TCP listener...&quot;);
  
          TcpListener listener = new TcpListener(ipAddress, 500);
  
          listener.Start();
  
          while (true)
          {
              Console.WriteLine(&quot;Server is listening on &quot; + listener.LocalEndpoint);
  
              Console.WriteLine(&quot;Waiting for a connection...&quot;);
  
              Socket client = listener.AcceptSocket();
  
              Console.WriteLine(&quot;Connection accepted.&quot;);
  
              Console.WriteLine(&quot;Reading data...&quot;);
  
              byte[] data = new byte[100];
              int size = client.Receive(data);
              Console.WriteLine(&quot;Recieved data: &quot;);
              for (int i = 0; i &lt; size; i++)
                  Console.Write(Convert.ToChar(data[i]));
  
              Console.WriteLine();
  
              client.Close();
          }
  
          listener.Stop();
      }
      catch (Exception e)
      {
          Console.WriteLine(&quot;Error: &quot; + e.StackTrace);
          Console.ReadLine();
      }
  }
  </code></pre>
  <p>As you can see , it always listens while working ,  but I would like to specify that I want the app be able to listen and to have multiple connections support in the same time.</p>
  <p>How could I modify this to constantly listen while also accepting the multiple connections?</p>