我有一个命名管道,当我使用在我的系统上运行的客户端访问它时,它工作正常
客户端尝试使用以下代码打开文件:
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;
}
在创建我使用过的命名管道时
lpszPipename = TEXT("\\\\.\\pipe\\iPipe01");
而不是myServerName
我用过.(Dot)
。当我从另一个系统运行客户端时,我得到 GLE 5(拒绝访问)。