static void Main(string[] args) { myState = ClientState.Init; string paramStr = args.Count() >= 2 ? args[1] : ""; myClient = new ProcessWrapper(); myClient.Init(null, IOModelHelper.GetIOType(args[0]), paramStr, ProcessControl); myClient.UpdateStatus(ProcessWrapper.ProcesssStatus.Running); Console.WriteLine("In the client...console"); myClient.SendProcessMessage("In the client...msg"); for (int i = 10; i > 0; i--) { myClient.SendProcessMessage("[CLIENT] Wait for sync..." + i.ToString()); } while (myState != ClientState.Ending && myClient.CheckProgress() != ProcessWrapper.ProcesssStatus.Ending) { System.Threading.Thread.Sleep(750); if (myState == ClientState.Running) { myClient.SendProcessMessage("[CLIENT] Wait..."); } } myClient.SendProcessMessage("[CLIENT] quitting client process..."); myClient.SendProcessMessage("QUIT"); // mark to the server that we're done... myClient.UpdateStatus(ProcessWrapper.ProcesssStatus.Ending); while (myClient.WaitingForWrite()) { myClient.CheckProgress(); } myClient.Cleanup(); }
static public void StartClient() { string myExeLoc = "C:\\Projects\\JPD\\BBRepos\\ProcessWrappers\\Client\\bin\\Debug\\Client.exe"; //myExeLoc = "D:\\Projects\\Workspaces\\BBRepos\\ProcessWrappers\\Client\\bin\\Debug\\Client.exe"; //myExeLoc = "C:\\Projects\\JPD\\BBRepos\\Chess\\engines\\stockfish\\stockfish_5_32bit.exe"; myHost = new ProcessWrapper(); string modelParams = IOModelHelper.IOTypeParam[thisPass]; switch (thisPass) { case IOType.PIPES: modelParams += " "; break; case IOType.QUEUES: modelParams += " "; break; case IOType.StdIO: modelParams += " "; break; } modelParams = ""; if (thisPass == IOType.QUEUES) { string clientID = Guid.NewGuid().ToString(); string typeID = "TestProcess.PrintSort"; List <string> listenRoutes = new List <string>(); List <string> postRoutes = new List <string>(); listenRoutes.Add(clientID + ".workUpdate." + typeID); listenRoutes.Add(clientID + ".workComplete." + typeID); postRoutes.Add(clientID + ".workRequest." + typeID); ConnectionDetail thisConn = new ConnectionDetail("localhost", 5672, "myExch", "topic", clientID, listenRoutes, "guest", "guest"); modelParams = "myExch|localhost|5672|guest|guest|"; modelParams += clientID + ".workUpdate." + typeID + "|"; modelParams += clientID + ".workComplete." + typeID + "|#|"; modelParams += clientID + ".workRequest." + typeID; } myHost.Init(myExeLoc, thisPass, modelParams, ProcessControl); }