Hi everyone,

I'm trying again to learn Alice again and I was trying to write a dummy
echo server, the cod I came up with is this:

fun serve (socket, host, port) =
        let
                val lineOpt = Socket.inputLine socket
        in
                case lineOpt of
                          SOME(line) => print line
                        | NONE       => ()
                        ;
                
                Socket.close socket
        end


val port = SOME 8802;
val (socket, port) = Socket.server (port, serve);
        
which imposes serialization of the requests. Now, if I want to serve
concurrent requests it seem enough to add "spawn" to the serve
declaration.

Is this correct idiomatic code or am I doing something stupid ?

Thanks in advance :)



-- 
goto 10: http://www.goto10.it
blog it: http://riffraff.blogsome.com
blog en: http://www.riffraff.info

_______________________________________________
alice-users mailing list
[email protected]
http://www.ps.uni-sb.de/mailman/listinfo/alice-users

Reply via email to