[plt-scheme] Why does this TCP client block?
I'm not having a problem with the "More" tutorial per se, but in
trying to adapt it, I've run into a problem. I'm sure this is user
error on my part, but I've modified the early examples to read s-
expressions and write them back. Unfortunately, my test driver blocks
when trying to read a response back from the server. Testing with
telnet works fine.
Here is the test driver
;;A simple test driver
(define (test-it port-no)
(begin
(printf "Starting server on port ~a~n" port-no)
(let ([stop (serve port-no test-handler)])
(printf "Connecting to server on port ~a~n" port-no)
(let-values ([(in out) (tcp-connect "localhost" port-no)])
(define msg '(a b c))
(printf "Sending message ~a~n" msg)
(write msg out)
(printf "Reading response...~n")
(let ([resp (read in)])
(printf "Response is ~a~n" msg))
(printf "Stopping server."))
(stop))))
"Oh would that my mind could let fall its dead ideas, as the tree
does its withered leaves."
--André Gide
http://www.gwoodhouse.com
http://GregWoodhouse.ImageKind.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080723/6b98b9e9/attachment.html>