iv.vfs: don't turn "w+" mode to "r+" mode, lol
[iv.d.git] / ncrpctest / rpcserver.d
blob5fbb78f3bdcbf6f26423fc3ff5edc63d548f4559
1 import iv.ncrpc;
2 import iv.vfs.io;
4 import rpcapi;
7 public bool doQuit = false;
10 string[] delegate () listEndpoints;
13 void main () {
14 rpcRegisterEndpoint!getList(delegate (int id, int di, string ds) {
15 writeln("getList: id=", id);
16 writeln("getList: di=", di);
17 writeln("getList: ds=", ds);
18 return ["boo"];
19 });
21 rpcRegisterEndpoint!quit(() { doQuit = true; });
23 //rpcRegisterEndpoint!listEndpoints;
24 rpcRegisterEndpoint!listEndpoints(() { return rpcEndpointNames; });
26 writeln(rpcEndpointNames);
27 UDSocket sk;
28 sk.create("/k8/rpc-test");
29 writeln("waiting for client...");
30 auto cl = sk.accept();
31 writeln("client comes.");
32 for (;;) {
33 auto cmd = cl.readNum!ushort;
34 if (cmd != RPCommand.Call) throw new Exception("invalid command");
35 cl.rpcProcessCall;
36 if (doQuit) break;