-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathTextIOCPServer.h
42 lines (36 loc) · 1.11 KB
/
TextIOCPServer.h
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
#pragma once
class UserBufferObject
{
public:
LONGLONG m_ulGuid;
CIOCPBufferWriter m_stBufferWriter;
LONG m_nRefs;
UserBufferObject();
};
class UserBufferList
{
private:
std::map <LONGLONG,UserBufferObject*> m_vBufferMap;
IOCPMutex m_stBufferLock;
public:
UserBufferObject* GetBufferObject(LONGLONG guid);
VOID AllocateBufferObject(LONGLONG guid);
VOID ReleaseBufferObject(LONGLONG guid);
VOID ReleaseBufferObject(UserBufferObject* object);
};
class CTextIOCPServer : public CBaseIOCPServer
{
public:
CTextIOCPServer(void);
virtual ~CTextIOCPServer(void);
UserBufferList m_stUserBufferMap;
VOID SendEx(PPER_SOCKET_CONTEXT lpPerSocketContext,LPCSTR lpszText);
public:
static DWORD GetStringLen(CONST BYTE* lpBuffer,DWORD dwBufferSize);
private:
//ÐèÒªµ÷Óø¸Àà
virtual VOID NotifyNewConnection(PPER_SOCKET_CONTEXT lpPerSocketContext);
virtual VOID NotifyDisconnectedClient(PPER_SOCKET_CONTEXT lpPerSocketContext);
virtual VOID NotifyReceivedPackage(PPER_SOCKET_CONTEXT lpPerSocketContext, CIOCPBuffer* pBuffer);
virtual VOID NotifyReceivedFormatPackage(PPER_SOCKET_CONTEXT lpPerSocketContext, LPCSTR lpszText);
};