1
2
3
4
5
6
7
8
9
10 def main [
11 local-scope
12 socket:num <- $open-server-socket 8080/port
13 $print [Mu socket creation returned ], socket, 10/newline
14 return-unless socket
15 session:num <- $accept socket
16 contents:&:source:char, sink:&:sink:char <- new-channel 30
17 sink <- start-running receive-from-socket session, sink
18 query:text <- drain contents
19 $print [Done reading from socket.], 10/newline
20 write-to-socket session, [HTTP/1.0 200 OK
21 Content-type: text/plain
22
23 SUCCESS!
24 ]
25 $print 10/newline, [Wrote to and closing socket...], 10/newline
26 session <- $close-socket session
27 socket <- $close-socket socket
28 ]