hy/eg/gevent/sockets/socket-server.hy
Gergely Nagy 494bf0e8ad Remove the import-as and import-from builtins
The new and improved (import) can handle all cases import-as and
import-from did, so drop the latter two from the language. To do this,
the import builtin had to be changed a little: if there's a single
import statement to return, return it as-is, otherwise return a list of
imports.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2013-04-20 16:06:32 +02:00

12 lines
266 B
Hy

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