I'm trying to connect to my own machine using my public IP. If I use 127.0.0.1
the connection is successful, but using the public IP results in the following error: "ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it"
.
According to MSDN, the error might appear because no server application is running; however, I did run the 'server.py' script first, before running 'client.py. What should I do to fix this?
server.py
from socket import *
sock = socket(AF_INET, SOCK_STREAM)
sock.bind(('127.0.0.1', 8888))
sock.listen(10)
conn, _ = sock.accept()
client.py
from socket import *
sock = socket(AF_INET, SOCK_STREAM)
sock.connect((MY_PUBLIC_IP, 8888))