title: WinError 10061, Python Server and Client connection problem
body: <p>I have two scripts: <code>server.py</code> and <code>client.py</code> and I am trying to connect them globally. They are something like this:</p>
  <p><code>server.py</code>:</p>
  <pre><code>import socket
  
  server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  server.bind((&quot;&quot;, 5050))
  
  while True:
      conn, addr = server.accept()
  </code></pre>
  <p><code>client.py</code>:</p>
  <pre><code>import socket
  client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  client.connect((&quot;[my public ip (don\'t want to give away)]&quot;, 5050))
  </code></pre>
  <p>When I run <code>server.py</code>, everything is fine. When I try to connect with <code>client.py</code>, I get the error message: <code>ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it</code>. I have Firewall turned off.</p>
  <p>Also, I have tried these questions but did not solve the problem:<br>
  <a href="https://stackoverflow.com/questions/2972600/no-connection-could-be-made-because-the-target-machine-actively-refused-it">No connection could be made because the target machine actively refused it?</a><br>
  <a href="https://stackoverflow.com/questions/55600630/how-to-fix-no-connection-could-be-made-because-the-target-machine-actively-refus">How to fix No connection could be made because the target machine actively refused it&#160;127.0.0.1:64527</a><br>
  <a href="https://stackoverflow.com/questions/9695224/no-connection-could-be-made-because-the-target-machine-actively-refused-it-127-0">No connection could be made because the target machine actively refused it 127.0.0.1:3446</a><br>
  <a href="https://stackoverflow.com/questions/28346177/no-connection-could-be-made-because-the-target-machine-actively-refused-it-127-0">No connection could be made because the target machine actively refused it 127.0.0.1</a><br>
  <a href="https://stackoverflow.com/questions/12993276/errno-10061-no-connection-could-be-made-because-the-target-machine-actively-re">Errno 10061 : No connection could be made because the target machine actively refused it ( client - server )</a></p>