title: Win Error 10061 No connection could be made because the target machine actively refused it
body: <p>I have been experimenting with the socket library for python. I made a simple program for the server and client where the client can message the server.</p>
  <h2>Here is my code for the server:</h2>
  <pre><code>import socket
  
  print(&quot;Host&quot;)
  
  socket_main = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  socket_main.bind(('127.0.0.1', 9999))
  
  socket_main.listen(1)
  conn, addr = socket_main.accept()
  
  while True:
      data = conn.recv(1204).decode()
      print(data)
  
  conn.close()
  </code></pre>
  <h2>Here is my code for the client</h2>
  <pre><code>import socket
  
  print(&quot;Client&quot;)
  
  socket_main = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  socket_main.connect(('127.0.0.1', 9999))
  
  while True:
      message = input(&quot;: &quot;)
      socket_main.send(message.encode())
  
  socket_main.close()
  </code></pre>
  <p>When I run these programs in two different terminals on one computer it works just fine, but when I try to run the server and client on different computers I get an error on the clients end saying, &quot;No connection could be made because the target machine actively refused it&quot;.</p>
  <p>I have tried changing the port multiple times but it didn't help. I have looked through a lot of other forums and I haven't been able to fix this problem for a while now so I decided to ask here.</p>