-
-
Save mcroydon/4423345 to your computer and use it in GitHub Desktop.
This file contains 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 fingure.core | |
(:gen-class)) | |
(use 'lamina.core 'aleph.tcp 'gloss.core) | |
(defn response [query] | |
(println (str "Received a request for " (if (clojure.string/blank? query) "index" query) ".")) | |
(if (clojure.string/blank? query) | |
"Greetings from the fingure finger daemon." | |
(str "Greetings from the fingure finger daemon.\r\nNo information about " query " found."))) | |
(defn handler [ch client-info] | |
(receive-all ch | |
#(enqueue-and-close ch (response %)))) | |
(defn -main[] | |
(start-tcp-server handler {:port 79, :frame (string :utf-8 :delimiters ["\r\n"])})) |
This file contains 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
$ finger @localhost | |
[localhost] | |
Trying 127.0.0.1... | |
Greetings from the fingure finger daemon. | |
$ finger foo@localhost | |
[localhost] | |
Trying 127.0.0.1... | |
Greetings from the fingure finger daemon. | |
No information about foo found. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment