C# で名前付きパイプを作成しました。
サーバ
using (NamedPipeServerStream pipeServer = new NamedPipeServerStream("testpipe", PipeDirection.Out))
{
Console.WriteLine("NamedPipeServerStream object created.");
Console.Write("Waiting for client connection...");
pipeServer.WaitForConnection();
Console.WriteLine("Client connected.");
try
{
using (BinaryWriter sw = new BinaryWriter(pipeServer))
{
sw.AutoFlush = true;
Console.Write("Enter text: ");
byte[] bytes = File.ReadAllBytes(@"C:\\Temp\test.png");
sw.Write(bytes);
}
}
catch (IOException e)
{
Console.WriteLine("ERROR: {0}", e.Message);
}
}
クライアント
using (NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", "testpipe", PipeDirection.In))
{
Console.Write("Attempting to connect to pipe...");
pipeClient.Connect();
Console.WriteLine("Connected to pipe.");
Console.WriteLine("There are currently {0} pipe server instances open.", pipeClient.NumberOfServerInstances);
using (BinaryReader sr = new BinaryReader(pipeClient))
{
byte[] list;
list = sr.ReadBytes(214);
}
}
Console.Write("Press Enter to continue...");
Console.ReadLine();
}
このパイプにはファイルが存在します。ディスクに保存せずにブラウザー (IE) で開くにはどうすればよいですか? ファイルが NT オブジェクトであることはわかっていますが、どのように開くのですか?