本文整理汇总了C++中CommData::GetSerialID方法的典型用法代码示例。如果您正苦于以下问题:C++ CommData::GetSerialID方法的具体用法?C++ CommData::GetSerialID怎么用?C++ CommData::GetSerialID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommData
的用法示例。
在下文中一共展示了CommData::GetSerialID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetMessageToAnswer
BOOL CommManager::SetMessageToAnswer( const CommData& commData )
{
BOOL bFound = FALSE;
m_mapSection.Enter();
{
ClientDataMap::iterator finditer = m_clientDataMap.find(commData.GetClientID());
if (finditer != m_clientDataMap.end())
{
DataMap& answerMap = finditer->second;
MSGSERIALID serialid = commData.GetSerialID();
DataMap::iterator aaiter = answerMap.find(serialid);
if (aaiter != answerMap.end())
{
SEND_AND_REPLY& aaData = aaiter->second;
if (! aaData.bReply)
{
aaData.bReply = TRUE;
aaData.replyData = commData;
bFound = TRUE;
}
}
}
}
m_mapSection.Leave();
return bFound;
}
示例2: HandleMessage
BOOL CommManager::HandleMessage( SOCKADDR_IN fromAddr, const LPBYTE pData, DWORD dwDataSize, COMM_NAME commName, CPGUID& cpguid )
{
ByteBuffer dataBuffer;
dataBuffer.Alloc(dwDataSize);
if (! XorFibonacciCrypt(pData, dwDataSize, (LPBYTE)dataBuffer, 2, 7))
{
return FALSE;
}
BOOL bRet = m_cp.AddRecvPacket(dataBuffer, dataBuffer.Size(), commName, &cpguid);
if (m_cp.HasReceivedMsg())
{
CPGUID from;
ByteBuffer recvMsgData;
if (m_cp.RecvMsg(recvMsgData, from))
{
//解析数据
CommData recvCommdata;
if (recvCommdata.Parse(recvMsgData, recvMsgData.Size()))
{
debugLog(_T("recv msg msgid[%I64u] serial[%I64u]"), recvCommdata.GetMsgID(), recvCommdata.GetSerialID());
tstring clientid;
CutupProtocol::CPGuid2Str(from, clientid);
recvCommdata.SetClientID(clientid.c_str());
SetMessageToAnswer(recvCommdata);
HandleMsgByMsgHandler(recvCommdata.GetMsgID(), recvCommdata);
}
else
{
errorLog(_T("parse message failed"));
}
}
}
if (bRet)
{
//更新心跳数据
tstring clientid;
CutupProtocol::CPGuid2Str(cpguid, clientid);
UpdateHeartbeat(clientid.c_str(), fromAddr);
}
return bRet;
}