Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f8f54b75e7
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (25 sloc) 0.708 kb
// A very primitive web server.
import io
import net
import async
val server = ServerSocket new(8080)
print("Waiting for connections...")
while true do
val socket = server accept()
// Start a new thread to respond to the request.
run with
// Process the request.
val request = socket readLine()
val parts = request split(" ")
// Only GET is supported.
if parts[0] != "GET" then return
val path = parts[1]
print("Serving " + path)
// Open the file being served.
open("." + path) use with
// Read it and write it to the socket.
socket write(it read())
socket close()
Jump to Line
Something went wrong with that request. Please try again.