When I try to use <a href="http://docs.racket-lang.org/web-server-internal/web-server.html?q=do-not-return#(def._((lib._web-server/web-server..rkt)._do-not-return))">do-not-return</a> I get this error: <font face="courier new, monospace">bonsai.rkt:22:3: do-not-return: unbound identifier in module</font><div>
<br></div><div>Then I tried <a href="http://docs.racket-lang.org/reference/Byte_and_String_Input.html?q=read-line&q=do-not-return#(def._((quote._~23~25kernel)._read-line))">read-line</a>, which worked, but it blocks the console output so I'll only see the things that my script is sending to the console after I hit Enter and finish the program. Is there a asynchronous way of doing this?<br>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 12, 2012 at 1:55 AM, Greg Hendershott <span dir="ltr"><<a href="mailto:greghendershott@gmail.com" target="_blank">greghendershott@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">If I understand correctly you simply need your main Racket thread to<br>
wait, for example, after your main thread calls your `start-server':<br>
<br>
(start-server)<br>
(displayln "Server started. Press ENTER to quit.")<br>
(read-line)<br>
;; End of your main RKT file<br>
<div class=""><div class="h5"><br>
<br>
On Sun, Nov 11, 2012 at 8:39 PM, Nathan Campos <<a href="mailto:nathanpc@dreamintech.net">nathanpc@dreamintech.net</a>> wrote:<br>
> I'm having some fun with tcp-listen with Racket, here's the simple start<br>
> server function that I'm using:<br>
><br>
> #lang racket<br>
><br>
> (define start-server<br>
> (lambda ([port 8080])<br>
> (current-custodian server-custodian)<br>
> ; Caps at 50 connections at the same time<br>
> (define listener (tcp-listen port 50 #t))<br>
> (define (loop)<br>
> (accept-and-handle listener)<br>
> (loop))<br>
> (define t (thread loop))<br>
> (lambda ()<br>
> (kill-thread t)<br>
> (tcp-close listener))<br>
> (fprintf (current-output-port) "Server started listening at ~a" port)))<br>
><br>
> It was running great on DrRacket, but when I tried to run it under racket<br>
> (the command-line executable) it shows the sever started message and quits,<br>
> so the server doesn't keep running. Is there anyway to make racket wait<br>
> until it's process gets killed or the user types something?<br>
><br>
> Best Regards,<br>
> Nathan Campos<br>
><br>
</div></div><div class=""><div class="h5">> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
</div></div></blockquote></div><br></div></div>