views:

60

answers:

2

I have a Named Pipe and It Works Fine While I access it using a Client which runs on My System

The Client tries to open the File using following code:

LPTSTR lpszPipename = TEXT("\\\\smyServerName\\pipe\\iPipe01"); 

      hPipe = CreateFile( 
         lpszPipename,   // pipe name 
         GENERIC_READ |  // read and write access 
         GENERIC_WRITE, 
         0,              // no sharing 
         NULL,           // default security attributes
         OPEN_EXISTING,  // opens existing pipe 
         0,              // default attributes 
         NULL);     


      if (hPipe != INVALID_HANDLE_VALUE) 
         break; 

      // Exit if an error other than ERROR_PIPE_BUSY occurs. 

      if (GetLastError() != ERROR_PIPE_BUSY) 
      {
         _tprintf( TEXT("Could not open pipe. GLE=%d\n"), GetLastError() ); 
         return -1;
      }

While Creating the Named Pipe I have used

lpszPipename = TEXT("\\\\.\\pipe\\iPipe01"); 

Instead of myServerName I have used .(Dot). I get GLE 5 (Access denied) while I run the client from another system.

+1  A: 

First things first - check your permissions and firewall. Almost always, when something works locally but not on the network, it's permissions.

(Had this problem more times than I can count!)

Ragster
A: 

AFAIR there was a change of security of anonymous access to named pipes in Windows Vista.
When you want to open it (with write access) from the anonymous account, you may have to change the pipe's security attributes as described here.

DyP