[plt-scheme] hamsup.ss problem with language selection
I'd like to use the hamsup teachpack for my intro class, but since v207,
it has not worked. The problem is with the (thread server-loop) in the
following code. (I removed the (thread server-loop) and essentially
created a "one-time-listener" that worked fine within the Advanced student.)
(module hamsup mzscheme
(require (lib "etc.ss"))
(provide install-listener)
;; install-listener: number (sexpr -> void) -> void
(define (install-listener port receiver)
(local [(define listener (tcp-listen port))
(define (server-loop)
(local [(define-values (client->me me->client)
(tcp-accept listener))]
(begin
(close-output-port me->client)
(let ([the-value (read client->me)])
(begin
(close-input-port client->me)
(receiver the-value)
(server-loop))))))]
(thread server-loop)))
If I run the teachpack within the (module...) language, I can create
listeners just fine. But within Advanced Student, I get the following
error:
> (install-listener 9877 (lambda (x) (display x)))
(make-server-loophash-table-get: expects type <hash-table> as 1st
argument, given: false; other arguments were: 'test-coverage-point45570
...)
The "(make-server-loop" is in blue and the "hash-table-get: ..." is in
red italics. This happens in both v300 and v301 (on linux). Note,
after this call, the unix netstat utility indicates that we are
listening on port 9877. Not surprisingly, messages to that port are not
processed by the lambda function.
Your help is greatly appreciated in advance!
--Wayne Iba