Example #1
0
 public static void StartServerUsingStreamProtocol()
 {
     Task.Factory.StartNew(() =>
     {
         var server = new NamedPipeServerStream(Path.GetTempPath() + "Pipetest");
         server.WaitForConnection();
         StreamProtocol sp = new StreamProtocol(server);
         while (true)
         {
             var line = sp.ReadString();
             sp.WriteString(String.Join("", line.Reverse()));
         }
     });
 }
Example #2
0
 public void communicatePipeUsingStreamProtocol(StreamProtocol sp)
 {
     while (true)
     {
         Console.WriteLine("PlanetCNC: ");
         string input = Console.ReadLine();
         if (String.IsNullOrEmpty(input))
         {
             break;
         }
         sp.WriteString(input);
         Console.WriteLine(sp.ReadString());
     }
 }