本文整理汇总了C++中CData::length方法的典型用法代码示例。如果您正苦于以下问题:C++ CData::length方法的具体用法?C++ CData::length怎么用?C++ CData::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CData
的用法示例。
在下文中一共展示了CData::length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onLoginSignal
void CPCRCHelloState::onLoginSignal(CData &data)
{
CLog::instance()->log(CLog::msgLvlInfo,_("Sending login request to root server.\n"));
CData request;
request.wrt((ireon::net::commandId)ireon::net::rspcCodes::scHelloLogin);
request.append(data.data(), data.length());
m_ownerConnection->write(request);
}
示例2: onSendVersionSignal
void CPCRCHelloState::onSendVersionSignal(CData &data)
{
CData versionData;
char clientVersion[] = {PRODUCT_VERSION};
for (int i = 0; i < 4; i++)
versionData << clientVersion[i];
CLog::instance()->log(CLog::msgFlagNetwork, CLog::msgLvlInfo,_("Initiating version negotiation.\n"));
CData request;
request.wrt((ireon::net::commandId)ireon::net::rspcCodes::scCheckVersion);
request.write(versionData.data(), versionData.length());
m_ownerConnection->write(request);
};
示例3: processCommand
void CNetConnection::processCommand(ireon::net::commandId id, CData& data, netAddress fromAddress)
{
if (fromAddress.m_type == netAddress::atInternalAddress)
CLog::instance()->log(CLog::msgFlagNetwork,CLog::msgLvlDebug,_("Received internal packet. Id = %d.\n"),id);
else
CLog::instance()->log(CLog::msgFlagNetwork,CLog::msgLvlDebug,_("Received packet. Id = %d.\n"),id);
if( !processSignal(id, fromAddress, data) )
{
if (fromAddress.m_type == netAddress::atExternalAddress)
{
CData response;
response.wrt((ireon::net::commandId) ireon::net::rcCommandNotFound);
response << id;
write(response);
}
CLog::instance()->log(CLog::msgLvlError,_("Can't process packet. Contents:\n"));
CLog::instance()->dump(CLog::msgLvlError,data.data(),data.length());
}
return;
};