| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- /*************************************************************************
- 【文件名】 NetLinkClient.h
- 【功能模块和目的】 网络连接客户端控制类头文件
- 【开发者及日期】 郑石诺 2015/03/19
- 【版本】 V1.0.0
- 【版权信息】 Copyright (C)2015 河南华谊网络科技有限公司
- 【更改记录】
- *************************************************************************/
- #pragma once
- #include "PduLinkInc.h"
- class CPduEntity;
- class CNetLinkMgr;
- /*************************************************************************
- 【类名】 CNetLinkClient
- 【功能】
- 【接口说明】 网络连接客户端控制类
- 【开发者及日期】 郑石诺 2015/03/19
- 【版本】 V1.0.0
- 【版权信息】 Copyright (C)2015 河南华谊网络科技有限公司
- 【更改记录】
- *************************************************************************/
- class CNetLinkClient : public CAsyncSocket
- {
- public:
- CNetLinkClient(CNetLinkMgr* a_pParent);
- virtual ~CNetLinkClient(void);
- bool mainClientMark(void) const { return m_IsMainClient; }
- bool& mainClientMark(void) { return m_IsMainClient; }
- const CString& farEndIp(void) const { return m_FarEndIp; }
- UINT farEndPort(void) const { return m_FarEndPort; }
- void setPeerInfo(PDU_DEV_TYPE a_DevType, int a_DevId);
- bool send(CPduEntity& a_Pdu);
- // SOCKET重载函数
- void OnReceive(int ErrorCode);
- void OnConnect(int ErrorCode);
- void OnClose(int ErrorCode);
- private:
- void __initBuffer(void);
- bool __sendBuffer(UCHAR a_Buf[], UINT a_BufLen);
- private:
- bool m_IsMainClient;
- CNetLinkMgr* m_pParent;
- CString m_FarEndIp; // far end IP
- UINT m_FarEndPort; // far end port
- PDU_DEV_TYPE m_PeerType; // 对端设备类型
- int m_PeerId; // 对端设备ID
- // SOCKET读取相关变量
- USHORT m_HasRead; // 已读取的数据缓冲区长度
- UCHAR m_ReadBuffer[PDU_HEAD_LEN + PDU_MAX_DATA_LEN]; // 已读取的缓冲区内容
- };
|