NamePipeServer.h 525 B

123456789101112131415161718192021222324252627
  1. #ifndef NAME_PIPE_SERVER_H
  2. #define NAME_PIPE_SERVER_H
  3. #include<windows.h>
  4. #include<iostream>
  5. class NamePipeServer
  6. {
  7. public:
  8. NamePipeServer()
  9. {
  10. pStr = _T("data from server");
  11. pPipeName = _T("\\\\.\\pipe\\testPipe");
  12. }
  13. //创建命名管道
  14. void CreateNamedPipeInServer();
  15. //从命名管道中读取数据
  16. void NamedPipeReadInServer();
  17. //往命名管道中写入数据
  18. void NamedPipeWriteInServer();
  19. private:
  20. HANDLE hNamedPipe;
  21. const char *pStr;
  22. const char *pPipeName;
  23. };
  24. #endif