[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Unable to create a simple HTTP server
From: |
Sam Lee |
Subject: |
Unable to create a simple HTTP server |
Date: |
Sat, 28 May 2022 14:45:51 +0000 |
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?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Unable to create a simple HTTP server,
Sam Lee <=