title: No connection could be made because the target machine actively refused it [not similar to others]
body: <p>I'm trying to learn Socket Programming, and I encountered this error while connecting to my server application.</p>
  
  <p>Here's my declaration of the TcpListener in the server application:</p>
  
  <pre><code>TcpListener listener = new TcpListener(IPAddress.Loopback, 5152);
  </code></pre>
  
  <p>and here's my declaration of the TcpClient in my client application:</p>
  
  <pre><code>TcpClient client = new TcpClient(Dns.GetHostEntry(IPAddress.Loopback).HostName, 5152);
  </code></pre>
  
  <p>I have read several questions like this, and I always get the same answer: Either the server application isn't listening to the port or not running at all. But I've double-checked the Resource Monitor and cmd using netstat to see if the service is listening to the port, and it is. I've also included the service in the Firewall exceptions, so I'm not sure why I keep getting this error while trying to connect to the server app.</p>
  
  <p>Any ideas?</p>