【发布时间】:2020-06-06 21:02:21
【问题描述】:
我在阿里巴巴免费弹性 IP 中运行代码时收到此消息:
OSError: [Errno 99] error while attempting to bind on address ('147.139.5.81', 31333): cannot assign requested address
这是在 Amazon EC2 中正确运行的代码:'
ip = '147.139.5.81' #In Amazon EC2, ip will be different
start_server = websockets.serve(
hello, ip, 31333
)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
ifconfig -a shows:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.31.173.211 netmask 255.255.240.0 broadcast 172.31.175.255
ether 00:16:3e:01:30:8e txqueuelen 1000 (Ethernet)
RX packets 473419 bytes 267646492 (267.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 309017 bytes 92824868 (92.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 72620 bytes 4035134 (4.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 72620 bytes 4035134 (4.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
%dig +short myip.opendns.com @resolver1.opendns.com 显示:
147.139.5.81
可能是什么问题?我已经使用 ip: 147.139.5.81 sshed 到这个 VPS
【问题讨论】: