bool CClientReConnectManager::SendDataUDP(int nServerID, const char* pIP, int nPort, const char* pMessage, uint32 u4Len, bool blIsDelete) { ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_ThreadWritrLock); mapReactorUDPConnectInfo::iterator f = m_mapReactorUDPConnectInfo.find(nServerID); if (f == m_mapReactorUDPConnectInfo.end()) { //如果这个链接已经存在,则不创建新的链接 OUR_DEBUG((LM_ERROR, "[CProConnectManager::Close]nServerID =(%d) is not exist.\n", nServerID)); if (true == blIsDelete) { SAFE_DELETE_ARRAY(pMessage); } return false; } CReactorUDPClient* pClientInfo = (CReactorUDPClient*)f->second; //发送数据 bool blSendRet = pClientInfo->SendMessage(pMessage, u4Len, pIP, nPort); if (true == blIsDelete) { SAFE_DELETE_ARRAY(pMessage); } return blSendRet; }
bool CClientReConnectManager::SendDataUDP(int nServerID, const char* pIP, int nPort, char*& pMessage, uint32 u4Len, bool blIsDelete) { ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_ThreadWritrLock); char szServerID[10] = {'\0'}; sprintf_safe(szServerID, 10, "%d", nServerID); CReactorUDPClient* pClientInfo = m_objClientUDPList.Get_Hash_Box_Data(szServerID); if (NULL == pClientInfo) { //如果这个链接已经存在,则不创建新的链接 OUR_DEBUG((LM_ERROR, "[CProConnectManager::Close]nServerID =(%d) is not exist.\n", nServerID)); if (true == blIsDelete) { SAFE_DELETE_ARRAY(pMessage); } return false; } //发送数据 bool blSendRet = pClientInfo->SendMessage(pMessage, u4Len, pIP, nPort); if (true == blIsDelete) { SAFE_DELETE_ARRAY(pMessage); } return blSendRet; }