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
Afficher les réponses par date
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 14-May-07, at 3:43 PM, François Magnan wrote: > 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? > It seems that the "debug" function is not defined: % gsi -:dar Gambit Version 4.0 beta 22 > (load "magnan.scm") "/Users/feeley/gambit/magnan.scm" > 12 12 - ------------- REPL is now in #<thread #2> ------------- *** ERROR IN #<procedure #3>, "magnan.scm"@8.14 -- Unbound variable: debug > If I (define debug pp) then things work fine. Marc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iD8DBQFGSMCL//V9Zc2T/v4RAuNDAJ9YDYKvX7cVz6cA4EboxpKZ6MGulACdH7a/ 5rPmhD3G6ly/e1hOX7X49QU= =bLMh -----END PGP SIGNATURE-----
Hi, Sorry, debug was defined in my file, I just didn't include it in the email. Now, I tried to call gsi -:dar like you did and it worked. I was calling the interpreter with Schemescript Eclipse plugin with gsi -:d- It also works if I launch gsi from the terminal but not if I launch it from Schemescript. Very strange... I will ask Dominique about this. Thank you, Francois Magnan On 14-May-07, at 4:03 PM, Marc Feeley wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > On 14-May-07, at 3:43 PM, François Magnan wrote: > >> 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? >> > > It seems that the "debug" function is not defined: > > % gsi -:dar > Gambit Version 4.0 beta 22 > > > (load "magnan.scm") > "/Users/feeley/gambit/magnan.scm" > > 12 > 12 > - ------------- REPL is now in #<thread #2> ------------- > *** ERROR IN #<procedure #3>, "magnan.scm"@8.14 -- Unbound > variable: debug > > > > > If I (define debug pp) then things work fine. > > Marc > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.3 (Darwin) > > iD8DBQFGSMCL//V9Zc2T/v4RAuNDAJ9YDYKvX7cVz6cA4EboxpKZ6MGulACdH7a/ > 5rPmhD3G6ly/e1hOX7X49QU= > =bLMh > -----END PGP SIGNATURE-----
François,
Sorry, debug was defined in my file, I just didn't include it in the email. Now, I tried to call
gsi -:dar
like you did and it worked.
I was calling the interpreter with Schemescript Eclipse plugin with
gsi -:d-
It also works if I launch gsi from the terminal but not if I launch it from Schemescript.
Very strange... I will ask Dominique about this.
I have the same exact problem. I guess the problem is that gsi does not have a terminal. I'm not sure what I can do about that. Let me investigate a little further. Dominique
participants (3)
-
François Magnan -
Marc Feeley -
schemeway@sympatico.ca