I have two scripts: server.py
and client.py
and I am trying to connect them globally. They are something like this:
server.py
:
import socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(("", 5050))
while True:
conn, addr = server.accept()
client.py
:
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(("[my public ip (don\'t want to give away)]", 5050))
When I run server.py
, everything is fine. When I try to connect with client.py
, I get the error message: ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
. I have Firewall turned off.
Also, I have tried these questions but did not solve the problem:
No connection could be made because the target machine actively refused it?
How to fix No connection could be made because the target machine actively refused it 127.0.0.1:64527
No connection could be made because the target machine actively refused it 127.0.0.1:3446
No connection could be made because the target machine actively refused it 127.0.0.1
Errno 10061 : No connection could be made because the target machine actively refused it ( client - server )