本文整理汇总了C++中NetAddress::Equal方法的典型用法代码示例。如果您正苦于以下问题:C++ NetAddress::Equal方法的具体用法?C++ NetAddress::Equal怎么用?C++ NetAddress::Equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetAddress
的用法示例。
在下文中一共展示了NetAddress::Equal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DispatchIncoming
int NetSocket::DispatchIncoming()
{
int length = 0;
int count = 0;
NetAddress from;
while ((length = ReceivePacketIntern(&from)))
{
if (length == -1)
break;
INetChannel *channel = (INetChannel *)m_Channels.GetFirst();
while (channel)
{
if (from.Equal(channel->GetTargetAddress())) {
channel->ProcessIncoming(m_Buffer, length);
break;
}
channel = (INetChannel *)m_Channels.GetNext();
}
// not found an existing channel for this address.
// create a new channel
if (!channel)
{
// do accept only connectionless (\xFF\xFF\xFF\xFF) incoming packet.
if (*(int *)m_Buffer == CONNECTIONLESS_HEADER)
{
NetPacket *p = new NetPacket;
p->time = m_System->GetTime();
p->address.FromNetAddress(&from);
p->connectionless = true;
p->seqnr = -1;
// cut connectionless data
p->data.Resize(length - 4);
p->data.WriteBuf(&m_Buffer[4], length - 4);
p->data.Reset();
m_IncomingPackets.AddHead(p);
}
}
count++;
}
return count;
}