CListenSocket.h
上传用户:hhs829
上传日期:2022-06-17
资源大小:586k
文件大小:1k
- //
- // CListenSocket.h
- // Created by Qiming Lu, 2002-02-25
- //
- #if !defined(__CListenSocket_h__)
- #define __CListenSocket_h__
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include <afxtempl.h>
- //////////////////////////////////////////////////////////////////////////////
- class CListenSocket
- {
- public:
- CListenSocket();
- virtual ~CListenSocket();
- // Attributes
- protected:
- SOCKET m_hSocket; // Socket handle
- bool m_bListening; // Listening thread active flag
- HANDLE m_hThrdFinish; // Listening thread terminate event
- int m_nLimitCount; // Max connection
- public:
- CList <SOCKET, SOCKET> m_ClientList;
- public:
- bool Create(int inPort);
- bool StartListen(void);
- void StopListen(void);
- bool Accept(void);
- // Limit connection feature
- void SetLimitConnection(int inMax);
- int GetLimitConnection(void);
- static UINT ListeningThrd(void *pParam);
- };
- #endif // !defined(__CListenSocket_h__)