Hi,
I'm trying to write a basic webserver in Gambit Scheme. However, my efforts are being stymied at the very beginning by the fact that I can't seem to even use the most basic procedures properly...can anyone help?
Here's what I'm trying to do now: (In REPL:)
Gambit Version 4.0 beta 21
(define s (open-tcp-server (list port-number: 8080 eol-encoding: 'cr-lf))) (define p (read s))
Then, I go to a browser (tried in both Opera and Firefox) http://localhost:8080
The browser goes to the page, and the `(read s)' stops blocking
Back at REPL:
(read-line p)
"GET / HTTP/1.1"
(display "content-type: text/plain\n" p) (display "Hello World!\n" p) (force-output p)
...And nothing happens...the page keeps trying to load, nothing is shown. What am I doing wrong? I tried looking at the code in the example webserver, but it didn't help much, since its much more complicated than what I'm trying to do here. Can anyone help?
Much obliged, James