hy/eg/gevent/sockets/socket-server.hy
Paul R. Tagliamonte 116862346a futzing
2013-03-27 20:52:06 -04:00

12 lines
266 B
Hy

(import-from gevent.server StreamServer)
(defn handle [socket address]
(.send socket "Hello from Lisp!\n")
(for [x (range 5)] (.send socket (+ (str x) "\n")))
(.close socket))
(def server (StreamServer (, "127.0.0.1" 5000) handle))
(.serve-forever server)