【发布时间】:2017-11-20 06:45:22
【问题描述】:
当我运行代码时:
name = socket.gethostname()
#ip = socket.gethostbyname(name)
port = 5000
ip = "90.95.52.220"
print("Ip server: %s"%ip)
s.bind((ip, port)
我得到这个错误:
“OSError: [WinError 10049] 请求的地址在其上下文中无效”
如果我使用 socket.gethostbyname(name) 获取 IP,它会给我一个 IP,但是通过使用该 IP,其他人无法连接到我的服务器。我能做些什么?我阅读了类似问题的答案,但没有一个有效。
【问题讨论】:
标签: python-3.x sockets