<div style="font-family:arial,sans-serif;font-size:13px">I'm having some fun with tcp-listen with Racket, here's the simple start server function that I'm using:</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap">        #lang racket</span><br></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap"><br>
</span></div><div style="font-family:arial,sans-serif;font-size:13px"><div><span style="white-space:pre-wrap">        </span>(define start-server</div><div><span style="white-space:pre-wrap">        </span>(lambda ([port 8080])</div><div>
<span style="white-space:pre-wrap">        </span> (current-custodian server-custodian)</div><div><span style="white-space:pre-wrap">                </span>; Caps at 50 connections at the same time</div><div><span style="white-space:pre-wrap">                </span>(define listener (tcp-listen port 50 #t))</div>
<div><span style="white-space:pre-wrap">                </span>(define (loop)</div><div><span style="white-space:pre-wrap">                </span> (accept-and-handle listener)</div><div><span style="white-space:pre-wrap">                </span> (loop))</div><div>
<span style="white-space:pre-wrap">                </span>(define t (thread loop))</div><div><span style="white-space:pre-wrap">                </span>(lambda ()</div><div><span style="white-space:pre-wrap">                </span> (kill-thread t)</div><div><span style="white-space:pre-wrap">                </span> (tcp-close listener))</div>
<div><span style="white-space:pre-wrap">        </span> (fprintf (current-output-port) "Server started listening at ~a" port)))</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
It was running great on DrRacket, but when I tried to run it under racket (the command-line executable) it shows the sever started message and quits, so the server doesn't keep running. Is there anyway to make racket wait until it's process gets killed or the user types something?</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Best Regards,</div><div style="font-family:arial,sans-serif;font-size:13px"><span style="white-space:pre-wrap"> Nathan Campos</span></div>