Fork me on GitHub

what would be a minimal example of hitting an nrepl, e.g. using something like netcat?


i.e. what's the hello world of nrepl?


or telnet


ok so apparently you can't use telnet unless you set the tty transport


trying to connect to an nrepl inside a docker container on a remote server. in docker i expose the nrepl (port 65432) to the host. then i ssh to the host with port forwarding:

ssh -vNL 40000:localhost:65432 my-remote-host
i verify there's a connection (at least i think this means it worked)
nc -vv localhost 40000
found 0 associations
found 1 connections:
     1: flags=82<CONNECTED,PREFERRED>
        outif lo0
        src ::1 port 65316
        dst ::1 port 40000
        rank info not available
        TCP aux info available

Connection to localhost port 40000 [tcp/safetynetp] succeeded!
then try to connect a repl client:
lein repl :connect localhost:40000
Warning: implicit middleware found: cider-nrepl.plugin/middleware
Please declare all middleware in :middleware as implicit loading is deprecated.
Connecting to nREPL at localhost:40000
SocketException The transport's socket appears to have lost its connection to the nR
EPL server
        nrepl.transport/bencode/fn--5187/fn--5188 (transport.clj:95)
        nrepl.transport/bencode/fn--5187 (transport.clj:95)
        nrepl.transport/fn-transport/fn--5159 (transport.clj:42)
        clojure.core/binding-conveyor-fn/fn--4676 (core.clj:1938) (
        java.util.concurrent.ThreadPoolExecutor.runWorker (
        java.util.concurrent.ThreadPoolExecutor$ (
628) (
Bye for now!
logs from ssh tunnel:
debug1: Connection to port 40000 forwarding to localhos
t port 65432 requested.
debug2: fd 8 setting TCP_NODELAY
debug1: channel 3: new [direct-tcpip]
debug2: channel 3: open confirm rwindow 2097152 rmax 32
debug2: channel 3: rcvd eof
debug2: channel 3: output open -> drain
debug2: channel 3: obuf empty
debug2: channel 3: chan_shutdown_write (i0 o1 sock 8 wf
d 8 efd -1 [closed])
debug2: channel 3: output drain -> closed
debug2: channel 3: read<=0 rfd 8 len 0
debug2: channel 3: read failed
debug2: channel 3: chan_shutdown_read (i0 o3 sock 8 wfd
 8 efd -1 [closed])
debug2: channel 3: input open -> drain
debug2: channel 3: ibuf empty
debug2: channel 3: send eof
debug2: channel 3: input drain -> closed
debug2: channel 3: send close
debug2: channel 3: rcvd close
debug2: channel 3: is dead
debug2: channel 3: garbage collecting
debug1: channel 3: free: direct-tcpip: listening port 4
0000 for localhost port 65432, connect from p
ort 49790 to port 40000, nchannels 4
any ideas?


what OS? I would try explicitly in the lein connect command


macos locally. ubuntu 16.04 on the server tried - same problem i'm starting the nrepl like:

(nrepl/start-server :port nrepl-port :bind "localhost")


verified i can: 1. ssh to host 2. docker exec into container 3. run lein connect and get a repl


the jvm might be prefering the ipv6 address for localhost