• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NET_Config函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NET_Config函数的典型用法代码示例。如果您正苦于以下问题:C++ NET_Config函数的具体用法?C++ NET_Config怎么用?C++ NET_Config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: NET_Init

/*
====================
NET_Init
====================
*/
void NET_Init()
{
#ifdef _WIN32
	int r;

	r = WSAStartup( MAKEWORD( 1, 1 ), &winsockdata );

	if ( r )
	{
		Com_Printf( "WARNING: Winsock initialization failed, returned %d\n", r );
		return;
	}

	winsockInitialized = true;
	Com_Printf( "Winsock Initialized\n" );
#endif

#ifdef HAVE_GEOIP
	geoip_data_4 = NET_GeoIP_LoadData( GEOIP_COUNTRY_EDITION );
	geoip_data_6 = NET_GeoIP_LoadData( GEOIP_COUNTRY_EDITION_V6 );
	Com_Printf( "Loaded GeoIP data: ^%dIPv4 ^%dIPv6\n", geoip_data_4 ? 2 : 1, geoip_data_6 ? 2 : 1 );
#endif

	NET_Config( true );

	Cmd_AddCommand( "net_restart", NET_Restart_f );
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:32,代码来源:net_ip.cpp


示例2: CL_Connect_f

void CL_Connect_f(void)
{
  char *server;

  if (Cmd_Argc() != 2) {
    Com_Printf("usage: connect <server>\n");
    return;
  }

  if (Com_ServerState()) {
    /* if running a local server, kill it and reissue
       note: this is connect with the save game system */
    SV_Shutdown("Server quit\n", false);
  } else {
    CL_Disconnect();
  }

  server = Cmd_Argv(1);

  NET_Config(true); /* allow remote */

  CL_Disconnect();

  cls.state = ca_connecting;
  Q_strlcpy(cls.servername, server, sizeof(cls.servername));
  cls.connect_time = -99999; /* HACK: CL_CheckForResend() will fire immediately */
}
开发者ID:greck2908,项目名称:qengine,代码行数:27,代码来源:cl_network.c


示例3: NET_Init

/*
====================
NET_Init
====================
*/
void NET_Init( void ) {
    int		r;

#ifdef _XBOX
    // Run NetStartup with security bypassed
    // this allows us to communicate with PCs while developing
    XNetStartupParams xnsp;
    ZeroMemory( &xnsp, sizeof(xnsp) );
    xnsp.cfgSizeOfStruct = sizeof(xnsp);

#ifdef _DEBUG
    xnsp.cfgFlags |= XNET_STARTUP_BYPASS_SECURITY;
#else
    xnsp.cfgFlags |= XNET_STARTUP_BYPASS_SECURITY;
//	xnsp.cfgFlags = 0;
#endif

    INT err = XNetStartup( &xnsp );
#endif

    r = WSAStartup( MAKEWORD( 1, 1 ), &winsockdata );
    if( r ) {
        Com_Printf( "WARNING: Winsock initialization failed, returned %d\n", r );
        return;
    }

    winsockInitialized = qtrue;
    Com_Printf( "Winsock Initialized\n" );

    // this is really just to get the cvars registered
    NET_GetCvars();

    //FIXME testing!
    NET_Config( qtrue );
}
开发者ID:Drakesinger,项目名称:jediacademypc,代码行数:40,代码来源:win_net.cpp


示例4: Sys_InitGame

int Sys_InitGame() {

   //Four args, three unused, and one I don't care to use.
   //char * gamedir[0x100];



   //gmodinfo might need zeroing out on server restarts and whatnot, but for the
   //first server, there ought to be no troubles.

   //Tracing sucks.
   SeedRandomNumberGenerator();

   Sys_InitMemory();

   if(Host_Init(&host_parms) == 0) { //failed.
      return(0);
   }

   Sys_Init(); //be after host_init, as cvars need memory.

   //COM_GetGameDirSize(gamedir, sizeof(gamedir));
   //Sys_InitAuthentication

   Host_InitializeGameDLL();
   Banlist_Init();
   NET_Config(1);

   return(1);
}
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:30,代码来源:sys.c


示例5: CL_Connect_f

//#include <sys/mman.h>
void CL_Connect_f( void )
{
	string server;

	if( Cmd_Argc() != 2 )
	{
		Msg( "Usage: connect <server>\n" );
		return;	
	}

	// default value 40000 ignored as we don't want to grow userinfo string
	if( ( cl_maxpacket->integer < 40000 ) && ( cl_maxpacket->integer > 99 ) )
	{
		cl_maxpacket->flags |= CVAR_USERINFO;
		userinfo->modified = true;
	}

	Q_strncpy( server, Cmd_Argv( 1 ), MAX_STRING );

	if( Host_ServerState())
	{	
		// if running a local server, kill it and reissue
		Q_strncpy( host.finalmsg, "Server quit", MAX_STRING );
		SV_Shutdown( false );
	}

	NET_Config( true ); // allow remote

	Msg( "server %s\n", server );
	CL_Disconnect();

	cls.state = ca_connecting;
	Q_strncpy( cls.servername, server, sizeof( cls.servername ));
	cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately
}
开发者ID:Reedych,项目名称:xash3d,代码行数:36,代码来源:cl_main.c


示例6: CL_Connect_f

/*
================
CL_Connect_f

================
*/
void CL_Connect_f (void)
{
	char	*server;

	if (Cmd_Argc() != 2)
	{
		Com_Printf ("usage: connect <server>\n");
		return;	
	}
	
	if (Com_ServerState ())
	{	// if running a local server, kill it and reissue
		SV_Shutdown (va("Server quit\n", msg), false);
	}
	else
	{
		CL_Disconnect ();
	}

	server = Cmd_Argv (1);

	NET_Config (true);		// allow remote

	CL_Disconnect ();

	cls.state = ca_connecting;
	strncpy (cls.servername, server, sizeof(cls.servername)-1);
	cls.connect_time = -99999;	// CL_CheckForResend() will fire immediately
}
开发者ID:jacqueskrige,项目名称:uqe-quake2,代码行数:35,代码来源:cl_main.c


示例7: SV_Startup

/*
===============
SV_Startup

Called when a host starts a map when it wasn't running
one before.  Successive map or map_restart commands will
NOT cause this to be called, unless the game is exited to
the menu system first.
===============
*/
void SV_Startup()
{
	if ( svs.initialized )
	{
		Com_Error( ERR_FATAL, "SV_Startup: svs.initialized" );
	}

	SV_BoundMaxClients( 1 );

	// RF, avoid trying to allocate large chunk on a fragmented zone
	svs.clients = ( client_t * ) calloc( sizeof( client_t ) * sv_maxclients->integer, 1 );

	if ( !svs.clients )
	{
		Com_Error( ERR_FATAL, "SV_Startup: unable to allocate svs.clients" );
	}

	svs.numSnapshotEntities = sv_maxclients->integer * PACKET_BACKUP * 64;

	svs.initialized = true;

	Cvar_Set( "sv_running", "1" );
#ifndef BUILD_SERVER
	NET_Config( true );
#endif

	// Join the IPv6 multicast group now that a map is running, so clients can scan for us on the local network.
	NET_JoinMulticast6();
}
开发者ID:BlueMustache,项目名称:Unvanquished,代码行数:39,代码来源:sv_init.cpp


示例8: SV_KillServer_f

/*
===============
SV_KillServer_f

Kick everyone off, possibly in preparation for a new game

===============
*/
static void SV_KillServer_f (void)
{
	if (!svs.initialized)
		return;
	SV_Shutdown ("Server was killed.\n", false);
	NET_Config ( NET_NONE );	// close network sockets
}
开发者ID:mattx86,项目名称:aprq2,代码行数:15,代码来源:sv_ccmds.c


示例9: SV_KillServer_f

/*
===============
SV_KillServer_f

Kick everyone off, possibly in preparation for a new game
===============
*/
void SV_KillServer_f( void )
{
	if( !svs.initialized ) return;
	Q_strncpy( host.finalmsg, "Server was killed", MAX_STRING );
	SV_Shutdown( false );
	NET_Config ( false ); // close network sockets
}
开发者ID:DeadZoneLuna,项目名称:xash3d,代码行数:14,代码来源:sv_cmds.c


示例10: M_PingServers

static void M_PingServers (void)
{
    int			i;
    netadr_t	adr = {0};
    char		*adrstring;

    if(!m_num_addresses)
        return;

    NET_Config (NET_CLIENT);		// allow remote

    adr.type = NA_BROADCAST;
    adr.port = BigShort(PORT_SERVER);
    CL_SendUIStatusRequests(&adr);

    // send a packet to each address book entry
    for (i=0; i<m_num_addresses; i++)
    {
        adrstring = local_server_addresses[i];
        Com_Printf ("pinging %s...\n", adrstring);
        if (!NET_StringToAdr (adrstring, &adr))
        {
            Com_Printf ("Bad address: %s\n", adrstring);
            continue;
        }
        if (!adr.port)
            adr.port = BigShort(PORT_SERVER);

        CL_SendUIStatusRequests(&adr);
    }
}
开发者ID:q3aql,项目名称:quake2,代码行数:31,代码来源:ui_joinserver.c


示例11: NET_Init

/*
====================
NET_Init
====================
*/
void NET_Init (void)
{
//	WORD	wVersionRequested; 
	int		r;

//	wVersionRequested = MAKEWORD(1, 1);
	

	r = WSAStartup (MAKEWORD(1, 1), &winsockdata);

	if (r)
		Com_Error (ERR_FATAL,"Winsock initialization failed.");

	NET_Common_Init ();

	net_rcvbuf = Cvar_Get ("net_rcvbuf", "0", 0);
	net_sndbuf = Cvar_Get ("net_sndbuf", "0", 0);

	//r1: needed for pyroadmin hooks
#ifndef NO_SERVER
	if (dedicated->intvalue)
		NET_Config (NET_SERVER);
#endif

	Com_Printf("Winsock Initialized\n", LOG_NET);




	//noudp = Cvar_Get ("noudp", "0", CVAR_NOSET);
	//noipx = Cvar_Get ("noipx", "0", CVAR_NOSET);

	//net_shownet = Cvar_Get ("net_shownet", "0", 0);
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:39,代码来源:net_wins.c


示例12: CLQ2_PingServers_f

void CLQ2_PingServers_f() {
	NET_Config( true );			// allow remote

	// send a broadcast packet
	common->Printf( "pinging broadcast...\n" );

	Cvar* noudp = Cvar_Get( "noudp", "0", CVAR_INIT );
	if ( !noudp->value ) {
		netadr_t adr;
		adr.type = NA_BROADCAST;
		adr.port = BigShort( Q2PORT_SERVER );
		NET_OutOfBandPrint( NS_CLIENT, adr, "info %i", Q2PROTOCOL_VERSION );
	}

	// send a packet to each address book entry
	for ( int i = 0; i < 16; i++ ) {
		char name[ 32 ];
		String::Sprintf( name, sizeof ( name ), "adr%i", i );
		const char* adrstring = Cvar_VariableString( name );
		if ( !adrstring || !adrstring[ 0 ] ) {
			continue;
		}

		common->Printf( "pinging %s...\n", adrstring );
		netadr_t adr;
		if ( !SOCK_StringToAdr( adrstring, &adr, Q2PORT_SERVER ) ) {
			common->Printf( "Bad address: %s\n", adrstring );
			continue;
		}
		NET_OutOfBandPrint( NS_CLIENT, adr, "info %i", Q2PROTOCOL_VERSION );
	}
}
开发者ID:janisl,项目名称:jlquake,代码行数:32,代码来源:main.cpp


示例13: CL_Rcon_f

/*
 * Send the rest of the command line over as
 * an unconnected command.
 */
void
CL_Rcon_f(void)
{
	char message[1024];
	int i;
	netadr_t to;

	if (!rcon_client_password->string)
	{
		Com_Printf("You must set 'rcon_password' before\n"
				   "issuing an rcon command.\n");
		return;
	}

	memset(&to, 0, sizeof(to));

	message[0] = (char)255;
	message[1] = (char)255;
	message[2] = (char)255;
	message[3] = (char)255;
	message[4] = 0;

	NET_Config(true);  /* allow remote */

	strcat(message, "rcon ");

	strcat(message, rcon_client_password->string);
	strcat(message, " ");

	for (i = 1; i < Cmd_Argc(); i++)
	{
		strcat(message, Cmd_Argv(i));
		strcat(message, " ");
	}

	if (cls.state >= ca_connected)
	{
		to = cls.netchan.remote_address;
	}
	else
	{
		if (!strlen(rcon_address->string))
		{
			Com_Printf("You must either be connected,\n"
					   "or set the 'rcon_address' cvar\n"
					   "to issue rcon commands\n");

			return;
		}

		NET_StringToAdr(rcon_address->string, &to);

		if (to.port == 0)
		{
			to.port = BigShort(PORT_SERVER);
		}
	}

	NET_SendPacket(NS_CLIENT, strlen(message) + 1, message, to);
}
开发者ID:Jenco420,项目名称:yquake2,代码行数:64,代码来源:cl_network.c


示例14: NET_Shutdown

void
NET_Shutdown(void)
{
	NET_Config(false); /* close sockets */

	WSACleanup();
}
开发者ID:Pickle,项目名称:yquake2,代码行数:7,代码来源:network.c


示例15: CL_Connect_f

//#include <sys/mman.h>
void CL_Connect_f( void )
{
	char server[ sizeof( cls.servername ) ];

	if( Cmd_Argc() != 2 )
	{
		Msg( "Usage: connect <server>\n" );
		return;	
	}
	
	Q_strncpy( server, Cmd_Argv( 1 ), sizeof( cls.servername ));

	if( Host_ServerState())
	{	
		// if running a local server, kill it and reissue
		Q_strncpy( host.finalmsg, "Server quit", MAX_STRING );
		SV_Shutdown( false );
	}

	NET_Config( true ); // allow remote

	Msg( "server %s\n", server );
	CL_Disconnect();

	cls.state = ca_connecting;
	Q_strncpy( cls.servername, server, sizeof( cls.servername ));
	cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:29,代码来源:cl_main.c


示例16: SV_Map_f

/*
==================
SV_Map_f

Goes directly to a given map without any savegame archiving.
For development work
==================
*/
void SV_Map_f( void )
{
	char	*spawn_entity;
	string	mapname;
	int	flags;

	if( Cmd_Argc() != 2 )
	{
		Msg( "Usage: map <mapname>\n" );
		return;
	}

	// hold mapname to other place
	Q_strncpy( mapname, Cmd_Argv( 1 ), sizeof( mapname ));
	
	// determine spawn entity classname
	if( sv_maxclients->integer == 1 )
		spawn_entity = GI->sp_entity;
	else spawn_entity = GI->mp_entity;

	flags = SV_MapIsValid( mapname, spawn_entity, NULL );

	if( flags & MAP_INVALID_VERSION )
	{
		Msg( "SV_NewMap: map %s is invalid or not supported\n", mapname );
		return;
	}
	
	if(!( flags & MAP_IS_EXIST ))
	{
		Msg( "SV_NewMap: map %s doesn't exist\n", mapname );
		return;
	}

	if(!( flags & MAP_HAS_SPAWNPOINT ))
	{
		Msg( "SV_NewMap: map %s doesn't have a valid spawnpoint\n", mapname );
		return;
	}

	// init network stuff
	NET_Config(( sv_maxclients->integer > 1 ));

	// changing singleplayer to multiplayer or back. refresh the player count
	if(( sv_maxclients->modified ) || ( deathmatch->modified ) || ( coop->modified ) || ( teamplay->modified ))
		Host_ShutdownServer();

	SCR_BeginLoadingPlaque( false );

	sv.changelevel = false;
	sv.background = false;
	sv.loadgame = false; // set right state
	SV_ClearSaveDir ();	// delete all temporary *.hl files

	SV_DeactivateServer();
	SV_SpawnServer( mapname, NULL );
	SV_LevelInit( mapname, NULL, NULL, false );
	SV_ActivateServer ();
}
开发者ID:Tox86,项目名称:xash3d,代码行数:67,代码来源:sv_cmds.c


示例17: NET_Shutdown

/*
====================
NET_Shutdown
====================
*/
void NET_Shutdown( void ) {
	if ( !winsockInitialized ) {
		return;
	}
	NET_Config( qfalse );
	WSACleanup();
	winsockInitialized = qfalse;
}
开发者ID:blaenk,项目名称:jedioutcast,代码行数:13,代码来源:win_net.cpp


示例18: Sys_ShutdownGame

void Sys_ShutdownGame() {

   //Sys_ShutdownAuthentication();
   Host_Shutdown();
   NET_Config(0);
   //Sys_ShutdownLauncherInterface();
   Sys_ShutdownMemory();
   //Sys_Shutdown();
}
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:9,代码来源:sys.c


示例19: NET_Shutdown

/*
====================
NET_Shutdown
====================
*/
void NET_Shutdown (void)
{
	NET_Config(NET_NONE);	// close sockets

#ifdef _WIN32
	WSACleanup();
#endif

	Cmd_RemoveCommand( "net_restart" );
}
开发者ID:chrisnew,项目名称:quake2,代码行数:15,代码来源:net.c


示例20: SV_KillServer_f

/*
 * Kick everyone off, possibly in preparation for a new game
 */
void
SV_KillServer_f(void)
{
	if (!svs.initialized)
	{
		return;
	}

	SV_Shutdown("Server was killed.\n", false);
	NET_Config(false);   /* close network sockets */
}
开发者ID:Clever-Boy,项目名称:yquake2,代码行数:14,代码来源:sv_cmd.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NET_DBG函数代码示例发布时间:2022-05-30
下一篇:
C++ NET_CompareBaseAdr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap