[英]How to create NAMED-PIPE in .NET-4?
如何在C#應用程序中創建.NET-4中的NAMED-PIPE?
下面是一段創建命名管道客戶端的代碼,它取決於我在使用命名管道在C ++和C#之間進行通信時回答的上一個問題
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();
}
}
}
最簡單的方法是使用WCF:
var binding = new System.ServiceModel.NetNamedPipeBinding(System.ServiceModel.NetNamedPipeSecurityMode.None)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.