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


C++ NetConnection::ListenNewClients方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
	char* worldaddress = argv[4];

	if (strlen(address) <= 0)
	{
		cerr << "Invalid address" << endl;
		exit(0);
	}
	if (port <= 0)
	{
		cerr << "Bad port specified" << endl;
		exit(0);
	}
	if (strlen(worldaddress) <= 0)
	{
		cerr << "Invalid worldaddress" << endl;
		exit(0);
	}
	if (signal(SIGINT, CatchSignal) == SIG_ERR)
	{
		cerr << "Could not set signal handler" << endl;
		return 0;
	}
	net.SaveInfo(address, port, worldaddress);

#ifdef EQC_SHAREDMEMORY
	// -Cofruben: Load Shared Memory
	EQC::Common::PrintF(CP_SHAREDMEMORY, "Loading Shared Memory Core...");
	SharedMemory::Load();
	EQC::Common::PrintF(CP_GENERIC, "Done.\n");
#else
	EQC::Common::PrintF(CP_ZONESERVER, "Loading items...\n");
	Database::Instance()->LoadItems();
#endif


	EQC::Common::PrintF(CP_SPELL, "Loading SP DAT...\n");
	spells_handler.LoadSpells(SPDat_Location);

	EQC::Common::PrintF(CP_ZONESERVER, "Loading guild and guild ranks...\n");
	zgm.LoadGuilds();

	EQC::Common::PrintF(CP_ZONESERVER, "Loading faction data...\n");
	Database::Instance()->LoadFactionData();

	EQC::Common::PrintF(CP_ZONESERVER, "Loading faction lists...\n");
	Database::Instance()->LoadNPCFactionLists();

	EQC::Common::PrintF(CP_ZONESERVER, "Loading Corpse decay Timers...\n");
	Database::Instance()->GetDecayTimes(npcCorpseDecayTimes);

	if (!worldserver.Init()) {
		cerr << "InitWorldServer failed" << endl;
	}

	//Yeahlight: Static zone support
	if(strcmp(zone_name, ".") == 0)
	{
		EQC::Common::PrintF(CP_ZONESERVER, "Entering sleep mode.\n");
	}
	else if(!Zone::Bootup(zone_name))
	{
		EQC::Common::PrintF(CP_ZONESERVER, "%s boot FAILED!\n", zone_name);
	}
	else
	{
		EQC::Common::PrintF(CP_ZONESERVER, "%s boot was successful.\n", zone_name);
	}

	Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
	net.StartProcessLoop();
	MNetLoop.lock();

	while(RunLoops)
	{
		Timer::SetCurrentTime();
		if (ZoneLoaded) {
			net.ListenNewClients();
			client_list.SendPacketQueues();
		}
		if (InterserverTimer.Check()) {
			InterserverTimer.Start();
			Database::Instance()->PingMySQL();
			entity_list.UpdateWho();
		}
		MNetLoop.unlock();
		Sleep(1);
		MNetLoop.lock();
	}
	MNetLoop.unlock();
	if (zone != 0)
		Zone::Shutdown(true);
	while (WorldLoopRunning || ProcessLoopRunning) {
		Sleep(1);
	}
#ifdef EQC_SHAREDMEMORY
	// -Cofruben: Unload Shared Memory.
	SharedMemory::Unload();
#endif
	return 0;
}
开发者ID:aceoyame,项目名称:OpenEQC,代码行数:101,代码来源:net.cpp


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