Changes for clojure.contrib.server-socket/create-server

zkim on Sun, 03 Oct 2010
;; A Simple server that dumps the input stream to the output stream.
;; In this example, the create-server function is called with two
;; arguments, a port number and an anonymous function. The input
;; and output stream arguments passed to the anonymous function are
;; bound to the standard input and output respectively.

(use 'clojure.contrib.server-socket)
(import  '(java.io BufferedReader InputStreamReader PrintWriter))

user=> (create-server
         8080
         (fn [in out]
           (binding
             [*in* (BufferedReader. (InputStreamReader. in))
              *out* (PrintWriter. out)]
             (loop []
               (println (read-line))
               (recur)))))

{:server-socket #<ServerSocket ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8080]>, :connections #<Ref@73f17a73: #{}>}
zkim on Sun, 03 Oct 2010
;; A Simple server that dumps the input stream to the output stream.
;; In this example, the create-server function is called with two
;; arguments, a port number and an anonymous function. The input
;; and output stream arguments passed to the anonymous function are
;; bound to the standard input and output respectively.

(use 'clojure.contrib.server-socket)
(import  '(java.io BufferedReader InputStreamReader PrintWriter))

user=> (create-server
         8080
         (fn [in out]
           (binding
             [*in* (BufferedReader. (InputStreamReader. in))
              *out* (PrintWriter. out)]
             (loop []
               (println (read-line))
               (recur)))))

{:server-socket #<ServerSocket ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8080]>, :connections #<Ref@73f17a73: #{}>}
zkim on Sun, 03 Oct 2010
;; A Simple server that dumps the input stream to the output stream.
;; In this example, the create-server function is called with two
;; arguments, a port number and an anonymous function. The input
;; and output stream arguments passed to the anonymous function are
;; bound to the standard input and output respectively.

(use 'clojure.contrib.server-socket)
(import  '(java.io BufferedReader InputStreamReader PrintWriter))

user=> (create-server
         8080
         (fn [in out]
           (binding
             [*in* (BufferedReader. (InputStreamReader. in))
              *out* (PrintWriter. out)]
             (loop []
               (println (read-line))
               (recur)))))
{:server-socket #<ServerSocket ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8080]>, :connections #<Ref@73f17a73: #{}>}
Santosh on Sun, 03 Oct 2010
;; A Simple server that dumps the input stream to the output stream.
;; In this example, the create-server function is called with two
;; arguments, a port number and an anonymous function. The input
;; and output stream arguments passed to the anonymous function are
;; bound to the standard input and output respectively.

(use 'clojure.contrib.server-socket)
(import  '(java.io BufferedReader InputStreamReader PrintWriter))

(create-server
  8080
  (fn [in out]
    (binding
      [ *in* (BufferedReader. (InputStreamReader. in))
        *out* (PrintWriter. out)]
      (loop []
        (println (read-line))
        (recur)))))