Created
March 16, 2012 06:12
-
-
Save sunng87/2048747 to your computer and use it in GitHub Desktop.
An echo server example for link
This file contains hidden or 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
(ns link-test.tcp | |
(:refer-clojure :exclude [float byte double]) | |
(:use [link core tcp codec])) | |
(def echo-handler | |
(create-handler | |
(on-message [ctx e] | |
(let [channel (.getChannel ctx)] | |
(.write channel | |
(.getMessage e)))))) | |
(defn -main [& args] | |
(tcp-server 5888 echo-handler | |
:codec (string :encoding :ascii :delimiter "\r\n")) | |
(println "server started on 5888")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment