Paste: protocol less networking

Author: kssreeram
Mode: text
Date: Thu, 28 Oct 2010 12:50:52
Plain Text |
import io.sockets.*;
import remote.messages.*;
import commandline.dispatch.*;

main() = dispatchMain(client, server);

client(args) {
    var name = args[0];
    var conn = StreamSocket(Inet("127.0.0.1", 27183));
    remoteMessage(conn, () => { println("Hello, ", name); });
}

server(args) {
    var listener = ListenSocket(Inet("127.0.0.1", 27183));
    while (true) {
        var conn, addr = ...accept(listener);
        answerRemoteMessage(conn);
    }
}

New Annotation

Summary:
Author:
Mode:
Body: