Named Pipes with .NET?
I'm trying to create a named pipe with .NET.
System.IO.FileStream fs = new FileStream( "\\\\.\\pipe\\name",
FileMode.Truncate, FileAccessWrite, FileShare.Read, 0x8000 );
after that, an System.IO.FileNotFountException occures.
Has anybody an idea how to create and use Named Pipes in .NET, with C#?
Thanks in advance!
Assuming that the name of the file was \\name:
Make sure that the file is already created. FileMode.Truncate will only open an existing file. If not, filenotfound exception is thrown. Try using something like FileMode.Open or FileMode.Append.
I hope that works.
I've tested it with FileMode.Create and FileMode.CreateNew, but no one workes!
I think the problem lies in the Pipe path ("\\\\.\\pipe\\..."). The path is not a usually know "File Path". Using System.IO.DirectoryInfo returnes named Pipes of your System...
Perhaps someone gets an idea...
System.IO.DirectoryInfo di = new
FileInfo afi = di.GetFiles();
foreach( FileInfo fi in afi )
Console.WriteLine( fi.ToString() );
>Assuming that the name of the file was \\name:
>Make sure that the file is already created. FileMode.Truncate will >only open an existing file. If not, filenotfound exception is >thrown. Try using something like FileMode.Open or >FileMode.Append.
>I hope that works.