On Nov 13, 7:35 am, Ross Thomas <[email protected]> wrote:
> (ns seq-server
> #^{:author "Ross Thomas <[email protected]>"}
> (:import (java.net ServerSocket)))
The metadata should come before the symbol it's applied to, i.e.
(ns #^{:author "Ross Thomas <[email protected]>"}
seq-server
(:import java.net.ServerSocket))
Putting the metadata first is a little ugly, but there's a patch
waiting in Assembla that's will add an attr-map argument to the ns
macro, so hopefully this shouldn't be an issue in future.
> (declare handle-client)
>
> (defn run []
> (doseq [[c a] work-seq]
> (send-off a handle-client c)))
>
> (defn handle-client [_ client]
> (.. client getOutputStream (write (.getBytes message)))
> (doto client
> .shutdownInput
> .shutdownOutput
> .close))
You might want to take a look at clojure.contrib.server-socket (http://
richhickey.github.com/clojure-contrib/server-socket-api.html). Then
you could write:
(defn run []
(create-server listen-port
(fn [input output]
(.write output (.getBytes message)))))
- James
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en