当前位置: 首页>>代码示例>>C++>>正文


C++ SystemAddress::IsLANAddress方法代码示例

本文整理汇总了C++中SystemAddress::IsLANAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ SystemAddress::IsLANAddress方法的具体用法?C++ SystemAddress::IsLANAddress怎么用?C++ SystemAddress::IsLANAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SystemAddress的用法示例。


在下文中一共展示了SystemAddress::IsLANAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Start

bool Server::Start(void)
{
	printf("Starting server!\n\n");
	printf("Port: %i\n", m_port);
	printf("Maximum clients: %i\n", m_noOfConnections);

	m_server->SetIncomingPassword(m_password.c_str(), (int)strlen(m_password.c_str()));
	m_server->SetTimeoutTime(30000, UNASSIGNED_SYSTEM_ADDRESS);
	//m_server->AttachPlugin(&m_logger);


	SocketDescriptor socketDesc[1];
	socketDesc[0].port = m_port;
	socketDesc[0].socketFamily = AF_INET;

	bool started = m_server->Startup(m_noOfConnections, socketDesc, 1) == RAKNET_STARTED;
	if (!started)
	{
		printf("Failed to start server!\n");
		return false;
	}
	
	m_server->SetMaximumIncomingConnections(m_noOfConnections);
	m_server->SetOccasionalPing(true);
	m_server->SetUnreliableTimeout(true);

	DataStructures::List<RakNetSocket2*> sockets;
	m_server->GetSockets(sockets);

	printf("\nSocket addresses used by RakNet:\n");
	for (unsigned int i = 0; i < sockets.Size(); ++i)
	{
		printf("%i. %s\n", i + 1, sockets[i]->GetBoundAddress().ToString(true));
	}

	printf("\nIP Addresses:\n");
	for (unsigned int i = 0; i < m_server->GetNumberOfAddresses(); ++i)
	{
		SystemAddress sa = m_server->GetInternalID(UNASSIGNED_SYSTEM_ADDRESS, i);
		printf("%i. %s (LAN=%i)\n", i + 1, sa.ToString(true), sa.IsLANAddress());
		SetConsoleTitle(sa.ToString(true));// (sa.ToString(true)));
	}

	printf("\nGUID: %s\n", m_server->GetGuidFromSystemAddress(UNASSIGNED_SYSTEM_ADDRESS).ToString());

	printf("\nServer started!!\n\n\n");
	return true;
}
开发者ID:ProjectStortSpel,项目名称:Network,代码行数:48,代码来源:Server.cpp


注:本文中的SystemAddress::IsLANAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。