void *CConnectionMgr::Listen(TUInt32 nIp,TUInt16 nPort,TUInt16 nMaxConnection,void *pIfCallBack) { CListener *p = new CListener(); if (NULL == p) { return 0; } TInt32 ret = p->Init(m_hCompletionPort,nIp, nPort, nMaxConnection,(IfListenerCallBack*)pIfCallBack,&m_conncectionPool,m_pParserFactory,m_pCryptorFactory); if (SUCCESS > ret) { p->Final(); delete p; return 0; } p->AttachToList(m_pListeners); m_pListeners = p; return p; }
void *CConnectionMgr::Listen(const TChar *pIp,TUInt16 port,TUInt16 maxConnection,void *pIfCallBack) { CListener *p = new CListener(); if (NULL == p) { return 0; } TUInt32 myIp = 0; if (pIp != NULL) { myIp = inet_addr(pIp); } TInt32 ret = p->Init(m_hCompletionPort,myIp, port, maxConnection,(IfListenerCallBack*)pIfCallBack,&m_conncectionPool,m_pParserFactory,m_pCryptorFactory); if (SUCCESS > ret) { p->Final(); delete p; return NULL; } p->AttachToList(m_pListeners); m_pListeners = p; return p; }