gpt4 book ai didi

scala - 远程监听 Akka-HTTP 端口

转载 作者:行者123 更新时间:2023-12-04 04:54:51 25 4
gpt4 key购买 nike

使用 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 是可能的并且设备是直接连接的。我究竟做错了什么?

最佳答案

替换 localhost0.0.0.0它会起作用。 localhost旨在仅在本地使用。

关于scala - 远程监听 Akka-HTTP 端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36455497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com