title: Firewall is not allowing my python client application to connect to a server running on my machine even after I turn off firewall completely
body: <p>I am learning about the python socket library and am running into problems whenever I try to connect to the server running on my localhost with a client application.</p>
  
  <p>Here is the server code:</p>
  
  <pre><code> import socket
  
   HOST = '127.0.0.1'  # Standard loopback interface address (localhost)
   PORT = 65432        # Port to listen on (non-privileged ports are &gt; 1023)
  
  with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
  s.bind((HOST, PORT))
  s.listen()
  conn, addr = s.accept()
  with conn:
      print('Connected by', addr)
      while True:
          data = conn.recv(1024)
          print(data)
  </code></pre>
  
  <p>Here is the code for my client application: </p>
  
  <pre><code> import socket
  
   HOST = "localhost" # The server's hostname or IP address
   PORT = 65432        # The port used by the server
  
   with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
       s.connect((HOST, PORT))
       s.sendall(b'Hello, world')
       data = s.recv(1024)
  
   print('Received', repr(data))
  </code></pre>
  
  <p>Here is my error message:</p>
  
  <pre><code> ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
  </code></pre>
  
  <p>Here is what I have tried so far:</p>
  
  <ol>
  <li><p>Disabling my Window's 10 firewall completely on the windows command prompt with the use of the following command: 
  netsh advfirewall set allprofiles state off. This did not work</p></li>
  <li><p>To windows firewall I added an inward rule and outward rule that allows any application on my OS to access a service running on port 65432</p></li>
  <li><p>I changed my python version from 3.8.2 to 3.7.7 because before hand I was able to run this code perfectly and I was using a python 3.7 version</p></li>
  <li><p>I tried multiple different methods of setting the HOST variable, which include "localhost", '127.0.0.1', socket.gethost(), and socket.gethostbyname("localhost")</p></li>
  </ol>
  
  <p>I am able to connect to the server through the use of the Window's telnet application but that is it. To be honest I have exhausted possible solutions that I can find online, and I know that this question has came up on this website a lot, but I have honestly tried every solution I have seen so far - which included three hours of searching.</p>
  
  <p>I appreciate any possible help that you guys can give, thanks.</p>