Esempio n. 1
0
 static void HandleClientRequest(SubProcess.RequestHandle request, string message)
 {
     Console.WriteLine("Server: got client request: {0}", message);
     request.Respond("Got it (" + message + ").");
 }
Esempio n. 2
-1
 static void HandleServerRequest(SubProcess.RequestHandle request, string message)
 {
     string[] stuff = message.Split(new char[] { ';' }, 2);
     switch (stuff[0]) {
         case "js":
             try {
                 object o = JSContext.Run(stuff[1], "*input*");
                 request.Respond("success;" + o.ToString());
             } catch (JavascriptException x) {
                 request.Respond("failure;" + (string)x.Data["V8StackTrace"]);
             }
             break;
         case "name":
             request.Respond("bob");
             break;
         case "quit":
             request.Respond("quitting");
             quitEvent.Set();
             break;
         case "blarble":
             request.Respond(request.SubProc.Request("this is a request"));
             break;
         default:
             request.Respond("error");
             break;
     }
 }