gpt4 book ai didi

c++ - 从另一个系统访问命名管道时拒绝访问

转载 作者:可可西里 更新时间:2023-11-01 12:08:13 26 4
gpt4 key购买 nike

我有一个命名管道,当我使用在我的系统上运行的客户端访问它时它工作正常

客户端尝试使用以下代码打开文件:

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"); 

我使用了 .(Dot) 而不是 myServerName。我从另一个系统运行客户端时收到 GLE 5(访问被拒绝)。

最佳答案

首先要做的事 - 检查您的权限和防火墙。几乎总是,当某些东西在本地工作而不在网络上工作时,它就是权限。

(遇到这个问题的次数多得数不过来!)

关于c++ - 从另一个系统访问命名管道时拒绝访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3667144/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com