News for hackers. Stuff that matters.
Re:Ask HN: Learning HTTP - writing a web server in which lan... by pwg on Tuesday July 26, 2011 @08:46AM (#2807040)
Consider a look at Tcl. Tcl's socket support makes creating a webserver almost trivial:

http://wiki.tcl.tk/11017

http://wiki.tcl.tk/3899

http://pietersz.co.uk/software/dandelion-server

http://wiki.tcl.tk/4333

http://wiki.tcl.tk/14413

http://wiki.tcl.tk/28412

http://wiki.tcl.tk/15244

That last one (15244) has a stated measurement of request rates of 1162 and 1127 per second (scroll down the page a bit).

The advantage you'd have with Tcl is that since it abstracts away so much of the low level details of sockets and handling connections, you get to concentrate on (and learn) the http protocol instead of the low level socket handling details.

As an example, here is the webserver from '28412 above, titled: "The Smallest Tcl Web Server"

   proc webServer {chan addr port} {
        while {[gets $chan] ne ""} {}
        puts $chan "HTTP/1.1 200 OK\nConnection: close\nContent-Type: text/plain\n"
        puts $chan "Hello World!"
        close $chan
    }

    socket -server webServer 2068
    vwait forever

There are no comments on this comment yet.