【发布时间】:2021-01-02 19:02:19
【问题描述】:
我有两个脚本:server.py 和 client.py,我正在尝试在全球范围内连接它们。它们是这样的:
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))
当我运行server.py 时,一切都很好。当我尝试与client.py 连接时,我收到错误消息:ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it。我已关闭防火墙。
另外,我也试过这些问题,但没有解决问题:
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 )
【问题讨论】:
标签: python sockets connection