Hi,
I found a strange behavior with open-tcp-server on MacOSX of GambitC4b20 and GambitC4b22. I was able to isolate the problem up to this point... Eval the following code
(define (rpc-server-start) (let ((rpc-command-queue (open-tcp-server 5000))) (thread-start! (make-thread (lambda () (let loop () (let ((incoming-connection (read rpc-command-queue))) (debug "Got connection\n") (serve-rpc-command incoming-connection) ) (loop))))) rpc-command-queue))
(define (serve-rpc-command incoming-connection) (let* ((command (read-line incoming-connection))) (display (string-append command "\n") incoming-connection) (display "ok!\n\n" incoming-connection) (force-output incoming-connection) (close-port incoming-connection)))
(define (main) (rpc-server-start) (loop-indefinitely) )
(define (loop-indefinitely) (thread-sleep! 1) (loop-indefinitely))
(main)
Then in a Terminal type
telnet 127.0.0.1 5000
type something and then return.
You should see:
Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. sdj sdj ok!
Now comment out the call to "loop-indefinitely" in the (main) function. If you try the telnet again it will not work...
This is not the case in the MingW (WinXP) versions.
It seems I cannot start a tcp-server in a thread and still get the read-eval-print loop. Anybody can help?
Thank you, Francois Magnan