1234567891011121314151617181920212223242526272829 |
- #ifndef _NAME_PIPE_CLIENT_H
- #define _NAME_PIPE_CLIENT_H
- #include<windows.h>
- #include<iostream>
- class NamePipeClient
- {
- public:
- NamePipeClient()
- {
- pStr = "data from client";
- pPipeName = "\\\\.\\pipe\\testPipe";
- }
- //打开命名管道
- void OpenNamedPipeInClient();
- //客户端从命名管道中读取数据
- void NamedPipeReadInClient();
- //客户端往命名管道中写入数据
- void NamedPipeWriteInClient();
- private:
- //用来保存在客户端通过 CreateFile 打开的命名管道句柄HANDLE
- HANDLE hNamedPipe;
- const char * pStr;
- const char * pPipeName;
- };
- #endif
|