本文整理汇总了C++中CAddress::ULong方法的典型用法代码示例。如果您正苦于以下问题:C++ CAddress::ULong方法的具体用法?C++ CAddress::ULong怎么用?C++ CAddress::ULong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAddress
的用法示例。
在下文中一共展示了CAddress::ULong方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessPacket
void CEventServer::ProcessPacket(CAddress& addr, int pSize)
{
// check packet validity
CEventPacket* packet = new CEventPacket(pSize, m_pPacketBuffer);
if(packet == NULL)
{
CLog::Log(LOGERROR, "ES: Out of memory, cannot accept packet");
return;
}
unsigned int clientToken;
if (!packet->IsValid())
{
CLog::Log(LOGDEBUG, "ES: Received invalid packet");
delete packet;
return;
}
clientToken = packet->ClientToken();
if (!clientToken)
clientToken = addr.ULong(); // use IP if packet doesn't have a token
CSingleLock lock(m_critSection);
// first check if we have a client for this address
map<unsigned long, CEventClient*>::iterator iter = m_clients.find(clientToken);
if ( iter == m_clients.end() )
{
if ( m_clients.size() >= (unsigned int)m_iMaxClients)
{
CLog::Log(LOGWARNING, "ES: Cannot accept any more clients, maximum client count reached");
delete packet;
return;
}
// new client
CEventClient* client = new CEventClient ( addr );
if (client==NULL)
{
CLog::Log(LOGERROR, "ES: Out of memory, cannot accept new client connection");
delete packet;
return;
}
m_clients[clientToken] = client;
}
m_clients[clientToken]->AddPacket(packet);
}