Toying with gevent
This commit is contained in:
parent
7eed26f0c3
commit
366264fbab
11
eg/gevent/sockets/socket-server.hy
Normal file
11
eg/gevent/sockets/socket-server.hy
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
(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)
|
Loading…
x
Reference in New Issue
Block a user