如何创建命名管道的.NET-4? [英] How to create NAMED-PIPE in .NET-4?

查看:112
本文介绍了如何创建命名管道的.NET-4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#应用程序中创建命名管道中的.NET 4?

How to create NAMED-PIPE in .NET-4 in your C# application?

推荐答案

下面是一张code创建一个命名管道客户端,它是从一个答案,一个<一解禁href="http://stackoverflow.com/questions/2697820/how-to-send-messages-between-c-dll-and-c-app-using-named-pipe/2703831#2703831">$p$pvious问题我回答了基于C之间的通讯++和C#使用命名管道

Here is a piece of code to create a Named Pipe client, it is lifted from an answer to a previous question I answered on communicating between C++ and C# using Named Pipes

using System; 
using System.Text; 
using System.IO; 
using System.IO.Pipes; 

namespace CSPipe 
{ 
  class Program 
  { 
    static void Main(string[] args) 
    { 
      NamedPipeClientStream pipe = new NamedPipeClientStream(".", "HyperPipe", PipeDirection.InOut); 
      pipe.Connect(); 
      using (StreamReader rdr = new StreamReader(pipe, Encoding.Unicode)) 
      { 
        System.Console.WriteLine(rdr.ReadToEnd()); 
      } 

      Console.ReadKey(); 
    } 
  } 
}

这篇关于如何创建命名管道的.NET-4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆