Thanks, Arron. I have a lot to learn about discerning the meaning of the
stack traces. It said line 27, but, as you point out, the real problem was
on line 28.
On Tuesday, August 28, 2012 10:36:15 PM UTC-4, Aaron Cohen wrote:
>
> Larry,
>
>You are missing a bit of important code from th
That seems to be right. I just tested it and that seem to fix the problem.
I am confused about why Clojure appears to give the wrong line number? Is
there often a difference between the line number Emacs gives and line
number in the stack trace?
On Tuesday, August 28, 2012 10:34:16 PM UTC-4
So, now I do this:
(defn run-server [port]
(let [server-socket (ServerSocket. port "localhost")]
(while (not (. server-socket isClosed))
(listen-and-respond server-socket who-is-here-now
(defn -main [& args]
(let [port (Integer/parseInt (first args))]
(println "Server is s
Larry,
You are missing a bit of important code from the example in the blog post.
In his original example, "echo" is a function (note the code block
that begins, (defn echo ...).
His "listen-and-respond" function is what handles reading from the
ServerSocket, and responding back on the s
See [1].
Valid ServerSocket constructors:
ServerSocket()
ServerSocket(int)
ServerSocket(int,int)
ServerSocket(int,int,InetAddress)
Your code is trying:
ServerSocket(int,string)
[1] http://docs.oracle.com/javase/1.4.2/docs/api/java/net/ServerSocket.html
On Tue, Aug 28, 2012 at 8:25 PM, larry
I apologize about the beginner questions. I am new to Clojure.
If I do this:
(defn run-server [port what-to-do]
(let [server-socket (ServerSocket. port "localhost")]
(while (not (. server-socket isClosed))
(listen-and-respond server-socket what-to-do
(defn -main [& args]
(let
>Command line arguments that are not strings need to be converted
> prior to use by your main function.
That makes sense, I need to cast it to a symbol, yes? I have a problem with
that though. At the REPL I tried something like this:
(def hey (resolve (symbol what-to-do)))
which worked grea
>
> The ctor call for ServerSocket should be (ServerSocket. port "localhost").
Thanks, but the code doesn't get that far. It's the line before that throws
the error:
(defn run-server [port what-to-do]
On Tuesday, August 28, 2012 7:49:54 AM UTC-4, Fogus wrote:
>
> The ctor call for S
And service should not be a string.
Am Dienstag, 28. August 2012 13:49:54 UTC+2 schrieb Fogus:
>
> The ctor call for ServerSocket should be (ServerSocket. port "localhost").
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, se
Check the type of `port'. Seems like arguments from the command line
gets passed as strings. You need to convert them to a number:
(Integer. port-string)
Cheers,
Moritz
larry google groups writes:
> So, this started when I read Keith Swallow's article on a simple web server:
>
> http://keithce
Command line arguments that are not strings need to be converted prior to
use by your main function.
Look at the code for the port number and do the same for the service.
--jon
On Aug 28, 2012, at 2:42, larry google groups
wrote:
So, this started when I read Keith Swallow's article on a simp
The ctor call for ServerSocket should be (ServerSocket. port "localhost").
--
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
12 matches
Mail list logo