Recently found that frequently I need a tcp server in newlisp to serve simple data requests.
But net-select etc. is a low-level stuff which needs many workarounds in a real usage.
So, once I'v decide to made a such one. Here is it:
http://en.feautec.pp.ru/store/libs/doc/net-do.lsp.html
TCP/IP server suite
TCP/IP server suite
WBR, Dmi
... also accessible via "Index: EnFeutec" on
http://www.newlisp.org/modules/
All newlispdoc documented modules can be accessed directly or indirectly from here.
http://www.newlisp.org/modules/
All newlispdoc documented modules can be accessed directly or indirectly from here.
Wow! Cool!
BTW, you can set EnFeautec link directly to the module index:
http://en.feautec.pp.ru/store/libs/doc/index.html
BTW, you can set EnFeautec link directly to the module index:
http://en.feautec.pp.ru/store/libs/doc/index.html
WBR, Dmi
example
A usage example:
Code: Select all
; use "nc host 8080" to connect, ? to request connections and x to shutdown server
(define (net-do-test)
(net-do 8080 nil 1000
; accept
(fn(conn)
(println "accept: " conn)
(net-send conn "hello!\n"))
; receive
(fn(conn , (buf ""))
(println "receive: "conn)
(net-receive conn 'buf 1000)
(if
(starts-with buf "?")
(net-send conn (string net-do:lconn))
(starts-with buf "x")
(set 'net-do:exit-cond true))
(net-send conn "bye!\n")
(net-do:close conn))
; cleanout
(fn(conn) (println "closed: " conn))
; cycle
nil
; idle
(fn()(println "idle: " net-do:lconn))))
WBR, Dmi