Yesod开发服务器仅侦听ipv6
我正在使用 yesod 0.9.2.2 运行“cabal install && yesod devel”,但它仅使用 ipv6 进行监听。有谁知道如何配置它来侦听 ipv4 吗?我在 Windows 7 上运行它。
谢谢
I'm running "cabal install && yesod devel" using yesod 0.9.2.2 but it is only listening using ipv6. Does anyone know how to configure it to listen on ipv4 as well? I'm running it on Windows 7.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
到目前为止,您所描述的症状已经在 BSD 和 Debian 上观察到,但看起来 Windows 也受到了影响。
这是 Yesod 的一个已知问题,或者实际上是 Wasp 的一个已知问题,或者更准确地说,是网络库的一个已知问题。跟进此问题的一个地方是 此 githup 问题 或 当前关于 haskell-lists 的讨论,部分是由你的问题引起的。
The symptom you describe have so far been observed on BSD and Debian, but it looks like Windows is also affected.
It is a known problem with Yesod, or actually with Wasp, or, to be precise, with the network library. One place to follow up on this issue is this githup issue or the current discussion on haskell-lists, which was partly caused by your question.
虽然我目前没有类似的设置来测试这一点,但您可能会发现,如果有东西正在侦听 IPv6 端口 X,并且在同一端口 X 上没有任何东西侦听 IPv4,则 IPv6 端口将接收连接。 IPv6 服务器将看到来自“IPv6”地址 ::ffff:1.2.3.4 的连接(这称为 IPv4 映射的 IPv6 地址)。内核提供 IPv6 和 IPv4 端点之间的转换。 IPv4 通过线路使用。
我不了解 Windows 7,但某些系统(例如一些 Linux 发行版)默认情况下会通过设置特定的 sysctl 来禁用此功能,这意味着服务器需要绑定到单独的IPv4 和 IPv6 套接字(根据我的经验,这是更好的选择)。应用程序可以自由地覆盖此默认行为。
While I don't currently have a similar setup to test this, you will probably find that if something is listening to IPv6 port X, and there is nothing listening on the same port X for IPv4, then the IPv6 port will receive the connection. The IPv6 server will see a connection coming from "IPv6" address ::ffff:1.2.3.4 (this is called an IPv4 Mapped IPv6 address). The kernel provides the translation between the IPv6 and IPv4 endpoints. IPv4 is used over the wire.
I don't know about Windows 7, but some systems (eg. some Linux distributions) will by default disable this feature by setting a particular sysctl, which would mean that the server would need to bind to separate IPv4 and IPv6 sockets (which is, in my experience, the preferable option). Applications are free to override this default behaviour.