使用 Akka-HTTP 将调用绑定(bind)到端口 9000 时
Http().bindAndHandle(routes, "localhost", 9000)
它开始监听端口,如“netstat -tulpn”所示
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp6 0 0 127.0.0.1:9000 :::* LISTEN
本地可以使用此端口。 然而 ,当我调用远程电话时,我得到:
curl: (7) Failed to connect to 169.254.0.2 port 9000: Connection refused
即使 ping 是可能的并且设备是直接连接的。我究竟做错了什么?
最佳答案
替换 localhost
与 0.0.0.0
它会起作用。 localhost
旨在仅在本地使用。
关于scala - 远程监听 Akka-HTTP 端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36455497/