title: TcpListener: How to listen on specific port on all interfaces?
body: <p>There are three overloads for constructing a <a href="http://msdn.microsoft.com/en-us/library/zsyxy9k2.aspx" rel="noreferrer"><code>TcpListener</code></a>:</p>
  
  <ul>
  <li><a href="http://msdn.microsoft.com/en-us/library/1y2a362e.aspx" rel="noreferrer"><code>public TcpListener(int port);</code></a> (<em>obsolete</em>)</li>
  <li><a href="http://msdn.microsoft.com/en-us/library/c4zw1w3a.aspx" rel="noreferrer"><code>public TcpListener(IPEndPoint localEP)</code></a></li>
  <li><a href="http://msdn.microsoft.com/en-us/library/c6z86e63.aspx" rel="noreferrer"><code>public TcpListener(IPAddress localaddr, int port)</code></a></li>
  </ul>
  
  <p>i <em>want</em> to listen on a particular port, but on <strong>all</strong> available interfaces. There <em>was</em> an overload available to do that, but it's been marked as <code>obsolete</code>.</p>
  
  <p>What is the new preferred/non-obsolete way to listen on a particular port on all interfaces with a <a href="http://msdn.microsoft.com/en-us/library/zsyxy9k2.aspx" rel="noreferrer"><code>TcpListener</code></a> in .NET?</p>
  
  <hr>
  
  <p>For helpfulness sake, an <a href="http://msdn.microsoft.com/en-us/library/system.net.ipendpoint.aspx" rel="noreferrer"><code>IPEndPoint</code></a> is:</p>
  
  <pre><code>public IPEndPoint(
      IPAddress address,
      int port
  )
  </code></pre>
  
  <p>which is what the 3rd overload is. And an <a href="http://msdn.microsoft.com/en-us/library/system.net.ipendpoint.address.aspx" rel="noreferrer"><code>IPAddress</code></a> takes, as its constructor:</p>
  
  <ul>
  <li>a <code>byte[]</code></li>
  <li>an <code>Int64</code></li>
  <li>a <code>byte[]</code> and an <code>Int64</code></li>
  </ul>