-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPipeClient.h
More file actions
63 lines (51 loc) · 1.31 KB
/
PipeClient.h
File metadata and controls
63 lines (51 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
#include <Windows.h>
#include <string>
/** Example Code
#include "IPCAPI.h"
#pragma comment(lib, "WinSysIPCx64.lib")
int main()
{
CPipeClient* client = nullptr;
Pipe_API::Create_Client(&client);
std::wstring pn = L"StartB";
client->Create(pn, 5000);
std::string msg("aaaab");
DWORD dwWritten = 0;
client->Write((LPVOID)msg.c_str(), msg.size(), &dwWritten);
return 0;
}
*/
/**
* @class CPipeClient
* @brief 윈도우 OS에서 파이프 통신하는 클래스
*/
class CPipeClient
{
public:
/**
* @brief 생성자
*/
CPipeClient();
/**
* @brief 소멸자
*/
virtual ~CPipeClient();
/**
* @brief 파이프 생성
* @param[in] wstrPipeName 생성할 파이프 이름
* @param[in] dwTimeOut 파이프 생성 타임아웃(ms)
* @return 성공시 true, 실패시 false 반환
*/
virtual bool Create(std::wstring & wstrPipeName, DWORD dwTimeOut);
/**
* @brief 파이프에 데이터 쓰기
* @param[in] lpBuffer 쓸 데이터
* @param[in] dwBufferSize 데이터 크기
* @param[out] lpBytesWritten 실제로 쓴 데이터 크기
* @return 성공시 true, 실패시 false 반환
*/
virtual bool Write(LPVOID lpBuffer, DWORD dwBufferSize, LPDWORD lpBytesWritten);
private:
HANDLE m_hPipe; ///< 파이프 핸들
};