baseserver.h
来自「A3服务端AccountServer源代码」· C头文件 代码 · 共 74 行
H
74 行
#ifndef _ZONESVR_BASESERVER_H_
#define _ZONESVR_BASESERVER_H_
#include <winsock2.h>
#include "defines.h"
#include "LoopThread.h"
class CBaseServer : public CLoopThread
{
public:
BOOL m_bConnect;
SOCKET m_sSocket;
WSAEVENT m_wsaEvent;
WSANETWORKEVENTS m_netEvent;
// recv buffer manage
char m_RecvMsgQBuf[MAX_MSG_Q_BUF];
int m_nRecvStartPos;
int m_nRecvEndPos;
// send buffer manage
char m_SendMsgQBuf[MAX_MSG_Q_BUF];
int m_nSendStartPos;
int m_nSendEndPos;
CRITICAL_SECTION m_csSend;
void Lock() { EnterCriticalSection(&m_csSend); }
void Unlock() { LeaveCriticalSection(&m_csSend); }
public:
CBaseServer();
virtual ~CBaseServer();
BOOL Connect(char * pszAddr, int nPort);
void SetNetEvent();
void SvrProc();
BOOL RecvMsg();
virtual BOOL SendMsg(void * pMsg, int nLen);
virtual void OnClose() {};
virtual void ParseMsg() {};
// Recv Msg Q 包府
int GetSizeInBuf();
BOOL PushMsgQ(void * pMsg, int nLen);
BOOL PopMsgQ(void * pMsg, int nLen);
void * PopMsgQ(int nLen);
// Send Msg Q 包府
int GetSizeInSendBuf();
BOOL PushSendMsgQ(void * pMsg, int nLen);
// Send thread 包府
BOOL InitSendThread();
virtual void LoopProc();
void SendProc();
void CloseSendThread();
//socket buffer resize
int ResizeSNDBUF(const int nSize);
int ResizeRCVBUF(const int nSize);
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?