Index: rmtmod.scm ================================================================== --- rmtmod.scm +++ rmtmod.scm @@ -1526,17 +1526,23 @@ (define (http-handle-api dbstruct $) (if (api-proc) ((api-proc) dbstruct $) ;; ($) => alist 'no-api-proc-set)) -(define (rmt:launch-server hostn) - (let* ((l (tcp-listen 4242))) - (define-values (i o) (tcp-accept l)) - (write-line "Hello!" o) - (print (read-line i)) - (close-input-port i) - (close-output-port o))) +(define (rmt:launch-server hostn port) + (let* ((l (tcp-listen port)) + (dbstruct #f)) + (let-values (((i o) (tcp-accept l))) + ;; (write-line "Hello!" o) + (let loop ((indat (read i))) + (let* ((res (api:process-request dbstruct indat))) + (case res + ((quit) + (close-input-port i) + (close-output-port o)) + (else + (write res o)))))))) #;(define (http-transport:run hostn) ;; Configurations for server (tcp-buffer-size 2048) (max-connections 2048)