This repository has been archived by the owner on Oct 21, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaning up mire.clj to use duck-streams.
- Loading branch information
1 parent
1c2e0d2
commit df141a4
Showing
1 changed file
with
9 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,17 +1,15 @@ | |||
#!/usr/bin/env clj | #!/usr/bin/env clj | ||
|
|
||
(ns mire | (ns mire | ||
(:use [clojure.contrib server-socket]) | (:use [clojure.contrib server-socket duck-streams])) | ||
(:import [java.io InputStreamReader OutputStreamWriter] | |||
[clojure.lang LineNumberingPushbackReader])) | |||
|
|
||
(def port 3333) | (def port (* 3 1111)) | ||
|
|
||
(defn- mire-handle-client [ins outs] | (defn mire-handle-client [in out] | ||
(binding [*in* (LineNumberingPushbackReader. (InputStreamReader. ins)) | (binding [*in* (reader in) | ||
*out* (OutputStreamWriter. outs)] | *out* (writer out)] | ||
(loop [input (read-line)] | (loop [] | ||
(println input) | (println (read-line)) | ||
(recur (read-line))))) | (recur)))) | ||
|
|
||
(defonce *server* (create-server port mire-handle-client)) | (def server (create-server port mire-handle-client)) |