static void Main(string[] args) { if (args.Length > 0 && args[0] == "-native") { // If the command line is "CSNamedPipeServer -native", // P/Invoke the native pipe APIs to create the named pipe. NativeNamedPipeServer.Run(); } else { // Use the types in the System.IO.Pipes namespace to create // the named pipe. This solution is recommended when you // program against .NET Framework 3.5 or any newer releases // of .NET Framework. //SystemIONamedPipeServer.Run(); } }
private void StartNamedPipeServer() { NamedPipeSrv = new NativeNamedPipeServer(@"\\.\pipe\MSScan"); NamedPipeSrv.Run(); }