|
#pragma once
|
|
#include "akNetworkLinker.h"
|
|
#include <Windows.h>
|
#include "akThread.h"
|
|
class AKNETWORK_DLLSPEC CakPIPEServer : public CakThreadInterface
|
{
|
public:
|
typedef void (*RecvMsgFunc) (char* pMsg, int nMsglen, void*);
|
typedef void (*SystemMsgFunc) (char* pMsg, int nMsglen, void*);
|
public:
|
CakPIPEServer(void);
|
~CakPIPEServer(void);
|
|
// ¼¹ö»ý¼º
|
bool CreateServer(char* pServerName, int nBufferSize = 4096);
|
// ¼¹öÁ¾·á
|
void CloseServer();
|
// »ý¼ºµÈ ¼¹ö ¾ÆÀÌÇÇ °ª ¾ò±â
|
char* GetServerName();
|
// ¸Þ¼¼Áö ¼Û½Å
|
bool Send(char* sendMsg, int length);
|
// ¼ÒÄÏ ¸Þ¼¼Áö ¼ö½Å ÄÝ¹é ¼³Á¤
|
void SetRecvMessageCallback(RecvMsgFunc userFunc, void* data = NULL);
|
// ½Ã½ºÅÛ ¸Þ¼¼Áö ¼ö½Å ÄÝ¹é ¼³Á¤
|
void SetSystemMessageCallback(SystemMsgFunc userFunc, void* data = NULL);
|
// ¼¹ö »ý¼º »óÅÂ
|
inline bool GetServerState(){return m_bServerCreate;};
|
|
|
|
unsigned int m_nRecvBufferSize;
|
|
protected:
|
void setSystemMsg(const char* format, ...);
|
virtual void threadRun();
|
|
protected:
|
HANDLE m_hNamedPipe;
|
char m_strPipename[64];// = L"\\\\.\\pipe\\MyNamedPipe";// ÆÄÀÌÇÁ ¿ÀºêÁ§Æ® À̸§
|
|
bool m_bServerCreate;
|
CakThread m_akThread;
|
|
|
|
|
//void (*pCallBackRecvMsg)(char*,int,void*); // Äݹé ÇÔ¼ö
|
RecvMsgFunc m_recvmsgFunc;
|
void* m_recvmsgData;
|
SystemMsgFunc m_systemmsgFunc;
|
void* m_systemmsgData;
|
};
|