craig worrall
2015-07-16 07:45:44 UTC
Hi
I have the following code:
(ns fun
(:require
[manifold.deferred :as d]
[aleph.tcp :as tcp]))
(def port 19989)
(defn connect
[]
(println "CONNECT..")
(d/on-realized
(tcp/client {:host "localhost" :port port})
(fn [connection]
(println (str "connector succeeded " connection)))
(fn [failure-arg]
(println (str "connector failed " failure-arg))
(Thread/sleep 3000)
(connect))))
(defonce S
(tcp/start-server
(fn [arg1 arg2] (println (str "server accepted" arg1 "and" arg2)))
{:port port}))
and when I (connect), 2 connections are made to the server.
fun=> (connect)
CONNECT..
connector succeeded ***@42709226
<< ⊠>>
server ***@6eee1e2and{:remote-addr
"127.0.0.1", :server-port 19989, :server-name "localhost"}
server ***@5c8049eband{:remote-addr
"127.0.0.1", :server-port 19989, :server-name "localhost"}
What have I done wrong here? Thanks!
Craig
I have the following code:
(ns fun
(:require
[manifold.deferred :as d]
[aleph.tcp :as tcp]))
(def port 19989)
(defn connect
[]
(println "CONNECT..")
(d/on-realized
(tcp/client {:host "localhost" :port port})
(fn [connection]
(println (str "connector succeeded " connection)))
(fn [failure-arg]
(println (str "connector failed " failure-arg))
(Thread/sleep 3000)
(connect))))
(defonce S
(tcp/start-server
(fn [arg1 arg2] (println (str "server accepted" arg1 "and" arg2)))
{:port port}))
and when I (connect), 2 connections are made to the server.
fun=> (connect)
CONNECT..
connector succeeded ***@42709226
<< ⊠>>
server ***@6eee1e2and{:remote-addr
"127.0.0.1", :server-port 19989, :server-name "localhost"}
server ***@5c8049eband{:remote-addr
"127.0.0.1", :server-port 19989, :server-name "localhost"}
What have I done wrong here? Thanks!
Craig
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.