How to use named pipes over a network?

I am trying to create a network connection through named pipes. I do this as msdn says . I am creating a server-side server function with a function.

CreateNamedPipe(
                     "\\\\.\\pipe\\myNamedPipe",
                     DUPLEX | FILE_FLAG_OVERLAPPED,
                     0,
                     255,
                     BUFFER_SIZE,
                     BUFFER_SIZE,
                     0,
                     IntPtr.Zero);

and tries to connect via the CreateFile () function

CreateFile(
                  "\\\\10.0.0.29\\pipe\\myNamedPipe",
                  GENERIC_READ | GENERIC_WRITE,
                  0,
                  IntPtr.Zero,
                  OPEN_EXISTING,
                  FILE_FLAG_OVERLAPPED,
                  IntPtr.Zero);

10.0.0.29 - server ip machines. If I try to run the client program on the server machine with the pipe name "\\. \ Pipe \ myNamedPipe" or "\\ 10.0.0.29 \ pipe \ myNamedPipe" (10.0.0.29 is the ip server) or "\\ localhost \ pipe \ myNamedPipe "is working fine.

So how to use named pipes over the network?

+3
source share
3 answers

3.5, .NET Framework, interop p/invoke. . : .NET 3.5 .

, NamedPipeClientStream Constructor (String, String), .

+3

Pipe , , IP-.

. .

, TCP .

, ... Socket...

+2

, , , , . API Windows WaitNamedPipe -, 0, , . 0 , , , , , - .

I ran into this problem and found that I am not alone: http://social.msdn.microsoft.com/Forums/sv-SE/netfxnetcom/thread/7bbf5a0b-3c22-4836-b271-999e514c321b

Until Microsoft provides a more convenient way to connect to remote named pipes, I completely stop using them, and I suggest you do the same. If for some reason you cannot connect almost immediately, you will receive a leaflet.

+2
source

All Articles