本文整理汇总了C++中TcpConnection::SetGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ TcpConnection::SetGroup方法的具体用法?C++ TcpConnection::SetGroup怎么用?C++ TcpConnection::SetGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TcpConnection
的用法示例。
在下文中一共展示了TcpConnection::SetGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
NetServer::onLeaveUdpGroup( const NetGroupOp& op )
{
NetGroupMap::iterator i = m_groups.find( op.groupId );
if ( i == m_groups.end() )
{
LOG( FT_WARN, _T("NetServer::onLeaveUdpGroup> %d not found"), op.groupId );
return;
}
TcpConnection* c = m_tcp.FindById( op.connectionId );
if ( c != 0 )
{
c->SetGroup( 0 );
}
NetGroup* group = i->second;
K_ASSERT( group != 0 );
group->Leave( op.connectionId );
LOG( FT_DEBUG,
_T("NetServer::onLeaveUdpGroup> %d left from %d"),
op.connectionId, group->GetId() );
}
示例2: ci
void
NetServer::onDestroyUdpGroup( const NetGroupOp& op )
{
NetGroupMap::iterator i = m_groups.find( op.groupId );
if ( i == m_groups.end() )
{
LOG( FT_WARN, _T("NetServer::onDestroyUdpGroup> %d not found"), op.groupId );
return;
}
NetGroup* group = i->second;
K_ASSERT( group != 0 );
// make TcpConnection to forget about group
const std::vector<uint>& remotes = group->GetRemotes();
std::vector<uint>::const_iterator ci( remotes.begin() );
std::vector<uint>::const_iterator ciEnd( remotes.end() );
for ( ; ci != ciEnd; ++ci )
{
TcpConnection* c = m_tcp.FindById( *ci );
if ( c != 0 )
{
c->SetGroup( 0 );
}
}
group->Fini();
LOG( FT_DEBUG,
_T("NetServer::onDestroyUdpGroup> %d destroyed"),
group->GetId() );
delete group;
m_groups.erase( i );
}