#include "stdafx.h"
#include
char Input[50]={0};
char Output[50]={0};
DWORD ReadByte,WriteByte;
BOOL rc;
int err;
int _tmain(int argc, _TCHAR* argv[])
{
HANDLE hPipe;
hPipe = CreateNamedPipe(L"\\\\.\\pipe\\PipeServe",PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED|WRITE_DAC,PIPE_TYPE_MESSAGE|PIPE_READMODE_BYTE|PIPE_WAIT,1,20,30,NMPWAIT_USE_DEFAULT_WAIT,NULL);
if(hPipe == INVALID_HANDLE_VALUE){
err = GetLastError();
printf("pipe create is fail! err = %d\n",err);
exit(1);
}
else
{
printf("pipe create is sucessful\n");
}
while (true)
{
rc = ConnectNamedPipe(hPipe,NULL);
if (rc == 0)
{
printf("Server is connection fial\n ");
exit(2);
}
else
{
printf("pipe connection is successful\n");
}
strcpy_s(Input,"");
strcpy_s(Output,"");
rc = ReadFile(hPipe,Input
进程通信——pipe_server
最新推荐文章于 2024-06-05 10:45:48 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)