本文整理汇总了C++中raknet::SystemAddress::IsLoopback方法的典型用法代码示例。如果您正苦于以下问题:C++ SystemAddress::IsLoopback方法的具体用法?C++ SystemAddress::IsLoopback怎么用?C++ SystemAddress::IsLoopback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类raknet::SystemAddress
的用法示例。
在下文中一共展示了SystemAddress::IsLoopback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintStatus
void PrintStatus( void ) {
// enumerate local addresses
size_t numAddresses = peer->GetNumberOfAddresses();
if ( numAddresses ) {
console.Print( PrintLevel::Normal, "Network primed on:\n" );
for ( size_t i = 0u; i < numAddresses; i++ ) {
Indent indent( 1u );
console.Print( PrintLevel::Normal, "%i. %s\n",
i + 1,
peer->GetLocalIP( i )
);
}
}
else {
console.Print( PrintLevel::Normal, "Network primed on %s\n",
peer->GetMyBoundAddress().ToString()
);
}
console.Print( PrintLevel::Normal, "GUID: %" PRIX64 "\n",
myGUID
);
// get a list of remote connections
uint16_t numRemoteSystems;
peer->GetConnectionList( nullptr, &numRemoteSystems );
RakNet::SystemAddress *remoteSystems = new RakNet::SystemAddress[numRemoteSystems];
peer->GetConnectionList( remoteSystems, &numRemoteSystems );
console.Print( PrintLevel::Normal, "%i connections (max: %i)\n",
numRemoteSystems,
peer->GetMaximumIncomingConnections()
);
if ( numRemoteSystems ) {
console.Print( PrintLevel::Normal, "Listing active connections...\n" );
for ( size_t i = 0u; i < numRemoteSystems; i++ ) {
RakNet::SystemAddress *sa = &remoteSystems[i];
Indent indent( 1u );
std::string type;
if ( sa->IsLANAddress() ) {
type = " LAN";
}
else if ( sa->IsLoopback() ) {
type = "LOOP";
}
else {
type = "INET";
}
console.Print( PrintLevel::Normal, "%s: %s - %s\n",
type.c_str(),
sa->ToString(),
connectionStateMessages[peer->GetConnectionState( *sa )]
);
}
}
delete[] remoteSystems;
}