我以前从未在Windows上做过IPC.目前我正在开发一对程序,一个标准的GUI/CLI应用程序和一个Windows服务.该应用程序必须告诉服务该做什么.因此,假设通信只是本地通信,那么这两个进程的最佳通信方法是什么?
最好的地方被定义为更健壮,更不容易出错,不是最高性能也不是最容易编码.
代码示例将非常受欢迎,但不是必需的:-)
注意我只是询问使用什么,标准TCP套接字,命名管道或其他一些通信方式.
谢谢!
嗨,根据我在这里的最后一个问题,我尝试编写一个sql编辑器或类似的东西,这样我尝试从C#连接到CMD并执行我的命令.现在我的问题是我连接到SQLPLUS后,我无法获得SQLPLUS命令,我审查的其他资源不满足我.请帮助我如何在连接到sqlplus之后,我可以在我的进程中运行我的sql命令吗?现在我用这个代码:
//Create process
System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
//strCommand is path and file name of command to run
pProcess.StartInfo.FileName = strCommand;
//strCommandParameters are parameters to pass to program
pProcess.StartInfo.Arguments = strCommandParameters;
pProcess.StartInfo.UseShellExecute = false;
//Set output of program to be written to process output stream
pProcess.StartInfo.RedirectStandardOutput = true;
//Optional
pProcess.StartInfo.WorkingDirectory = strWorkingDirectory;
//Start the process
pProcess.Start();
//Get program output
string strOutput = pProcess.StandardOutput.ReadToEnd();
//Wait for process to finish
pProcess.WaitForExit();
Run Code Online (Sandbox Code Playgroud)
我定制了它.我分开初始化,我创建过程对象一次我还有问题,运行第二个命令我使用这些代码进行第二次调用:
pProcess.StartInfo.FileName = strCommand;
//strCommandParameters are parameters …Run Code Online (Sandbox Code Playgroud)