[racket] Prevent racket From Closing

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sun Nov 11 22:46:14 EST 2012

There's a function called do-not-return (search for it), that waits on an
anonymous empty semaphore, that the Web server uses.

Sent from my iPhone

On 2012/11/11, at 18:44, Nathan Campos <nathanpc at dreamintech.net> wrote:

I'm having some fun with tcp-listen with Racket, here's the simple start
server function that I'm using:

#lang racket

 (define start-server
(lambda ([port 8080])
   (current-custodian server-custodian)
; Caps at 50 connections at the same time
(define listener (tcp-listen port 50 #t))
 (define (loop)
  (accept-and-handle listener)
 (define t (thread loop))
(lambda ()
  (kill-thread t)
  (tcp-close listener))
   (fprintf (current-output-port) "Server started listening at ~a" port)))

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?

Best Regards,
Nathan Campos

 Racket Users list:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121111/134fee3f/attachment.html>

Posted on the users mailing list.