Cider nREPL using virtualbox error: connection broken by remote peer

Cider nREPL using virtualbox error: connection broken by remote peer

开始使用:

lein repl :headless :port 4242

当我尝试连接 VIA cider connect 时,出现以下错误:

Connection closed unexpectedly (connection broken by remote peer)

当我尝试连接 VIA 时:

lein repl :connect 4242

我收到以下错误:

SocketException The transport's socket appears to have lost its connection to the nREPL server
        clojure.tools.nrepl.transport/bencode/fn--5154/fn--5155 (transport.clj:95)
        clojure.tools.nrepl.transport/bencode/fn--5154 (transport.clj:95)
        clojure.tools.nrepl.transport/fn-transport/fn--5126 (transport.clj:42)
        clojure.core/binding-conveyor-fn/fn--4676 (core.clj:1938)
        java.util.concurrent.FutureTask.run (FutureTask.java:266)
        java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
        java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
        java.lang.Thread.run (Thread.java:748)
Bye for now!

默认情况下,nrepl 仅侦听来自同一台计算机的连接。它通过 "binding" 其侦听器对环回网络 127.0.0.1 的 IP 地址执行此操作。如果你想让它监听来自任何地方的连接,你可以将它绑定到 0.0.0.0 这是 any 网络地址,或者特定适配器的地址。

看来我需要将主机指定为 0.0.0.0,例如

lein repl :headless :host 0.0.0.0 :port 4242