Permalink
Browse files

Mire: An echo server is born

  • Loading branch information...
Andreas Pauley
Andreas Pauley committed Dec 16, 2009
1 parent e3ca835 commit 52252c867974fb93713a980f0ebd209c66bd66b3
Showing with 19 additions and 0 deletions.
  1. +1 −0 PeepCode/Clojure/mire/README
  2. +18 −0 PeepCode/Clojure/mire/src/echo-server.clj
@@ -0,0 +1 @@
+My re-implementation of mire.
@@ -0,0 +1,18 @@
+(ns mire
+ (:use [clojure.contrib server-socket duck-streams]))
+
+(def port 3333)
+
+(defn mire-handle-client [in out]
+ (binding [*in* (reader in) ; Re-assign stdin and stdout
+ *out* (writer out)]
+ (loop []
+ (print "You typed: ")
+ (println (read-line))
+ (recur))))
+
+(def server (create-server port mire-handle-client))
+
+(comment
+ (close-server server)
+)

0 comments on commit 52252c8

Please sign in to comment.