I have tried to create a simple HTTP server in MIT Scheme 11.2: (let* ((socket (open-tcp-server-socket 8000)) (port (tcp-server-connection-accept socket #t #f)) (request (read-http-request port)) (response (make-simple-http-response "Hello!"))) (write-http-response response port))
When I run the code and access localhost:8000 from my web browser, MIT Scheme will fail with this error: ;The object #[textual-i/o-port 12 for channel: #[channel 13]], passed as an argument to #[compiled-procedure 14 ("binary-port" #x2) #x1c #x13fd6f4], is not the correct type. I tried to replace the "tcp-server-connection-accept" procedure with "tcp-server-binary-connection-accept" but that did not work because MIT Scheme then fails with this error: ;The object 3, passed as the second argument to vector-ref, is not in the correct range. Is there a bug in MIT Scheme, or is there something wrong with my code? How do I write a simple example of a HTTP server in MIT Scheme?