It looks like your connection is broken somehow, this might be caused by an OS level issue(firewall etc.) but not the application itself. To test if this is due to an OS level issue, I suggest you to try connect nREPL by telnet, here's how to start nREPL in a TTY mode, in any REPL session type following: -------------------------------------------------------------------------------------
(use 'clojure.tools.nrepl.server) (require '[clojure.tools.nrepl.transport :as t]) (*defonce* server (start-server :transport-fn t/tty :port 999)) ------------------------------------------------------------------------------------- then use telnet to connect to your new started nREPL server: telnet localhost 999. In my opinion, if you can get through by this way, then it's the app issue; otherwise it may caused by OS setting/issue. I wrote a small nREPL client(but in Lua: https://github.com/xiejianming/lua_nrepl_client) before. Something might cause your interest is that, by using this tool, you can check bencoded (default encoding protocol used by nREPL) messages sent by nREPL server directly; and you can also check something I call naked message from server. Just hope this will help you a little bit.... 在 2012年12月27日星期四UTC+8上午6时55分53秒,frye写道: > > Hi all, > > I'm trying to put together some nrepl > middleware<https://github.com/clojure/tools.nrepl#middleware>. > To get a basic understanding, I thought I would implement some simple nrepl > middleware in a test project as seen in *A)*. I can execute `M-x > nrepl-jack-in`. But executing the client, gives me an empty result > (`repl/response-values` pulls nil out of ()). So I tried a bare bones > communication example in the middleware > page<https://github.com/clojure/tools.nrepl#talking-to-an-nrepl-endpoint-programmatically> > (see *B*), but am still getting an error. > > I like the example > given<https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L138>in > the leiningen sample project. But it seems I need to get the basics > working in *A)* and *B)*, first. > > Any insights here? Ultimately, I would like to create nrepl middleware for > i) Clojurescript compilation (*cljsbuild auto* (yes, I've already looked > at *hiredman/nrepl-cljs-middleware*)) and ii) a browser-connected repl > (*cljsbuild > repl-listen*). I want to have these facilities in a `*M-x nrepl-jack-in*` > session. > > > *A) basic nrepl middleware* > > > - project.clj (https://www.refheap.com/paste/7875) > - middleware.clj (https://www.refheap.com/paste/7874) > - client.clj (https://www.refheap.com/paste/7876) > > > *B) lein repl* > > $ lein new thing > ... > $ cd thing/ > $ lein repl > > nREPL server started on port 38789 > ... > user=> (require '[clojure.tools.nrepl :as repl]) > nil > > user=> > user=> (with-open [conn (repl/connect :port 38789)] > #_=> (-> (repl/client conn 1000) > #_=> (repl/message {:op "eval" :code "(+ 2 3)"}) > #_=> repl/response-values)) > > Exception in thread "nREPL-worker-2" nil > user=> java.net.SocketException: Broken pipe > at java.net.SocketOutputStream.socketWrite0(Native Method) > at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) > at java.net.SocketOutputStream.write(SocketOutputStream.java:136) > at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) > at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123) > at clojure.tools.nrepl.transport$bencode$fn__214.invoke(transport.clj:81) > at clojure.tools.nrepl.transport.FnTransport.send(transport.clj:27) > at > clojure.tools.nrepl.middleware.pr_values$pr_values$fn$reify__479.send(pr_values.clj:23) > at > clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__536$fn__538.invoke(interruptible_eval.clj:171) > at clojure.core$comp$fn__4034.invoke(core.clj:2278) > at > clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__529.invoke(interruptible_eval.clj:137) > at clojure.lang.AFn.run(AFn.java:24) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:619) > > > > > Thanks in advance > > Tim Washington > Interruptsoftware.ca > > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en