⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warsocketengine.h

📁 ftpserver very good sample
💻 H
字号:
/**   There must be one WarSocketEngine object in  each therad using WarSocket* object.  The engine handles global data for sockets and  calls system-dependent initializion routines.  The applications main-thread must cerate it's   engine before any worker-therads, as the first   created object will be used as a shared object.*/#ifndef WAR_SOCKET_ENGINE_H#define WAR_SOCKET_ENGINE_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_CRITICAL_SECTION_H#   include "WarCriticalSection.h"#endif#ifndef WAR_EXCEPTION_H#   include "WarException.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */class WarSocketIo;#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarSocketEngine {public:    // LIFECYCLE        /**    * Default constructor.    */    WarSocketEngine(void);            /**    * Destructor.    */    ~WarSocketEngine(void);        // OPERATORS    // OPERATIONS                           static war_int64_t GetNewSeqNumber()         throw(WarException);    static size_t GetNumberOfCurrentSockets()        throw(WarException);    static void RegisterSocket(WarSocketIo *pSocket)        throw(WarException);    static void UnregisterSocket(WarSocketIo *pSocket)        throw(WarException);    // ACCESS    static WarSocketEngine& GetSharedEngine()        throw(WarException)    {        if (mpShared == NULL)            WarThrow(WarError(WAR_ERR_INTERNAL_DATA_NOT_INITIALIZED), NULL);        return *mpShared;    }    // INQUIRY    bool IsShared() const    {        return mpShared == this;    }    protected:private:    WarCriticalSection mLock;    war_int64_t mCurrSeqNumber;    size_t mNumSocketsInUse;    static WarSocketEngine *mpShared; // Shared for all therads};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WarSocketEngine_h_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -