CUGL 2.1
Cornell University Game Library
Public Member Functions | Public Attributes | List of all members
cugl::NetworkConnection::ConnectionConfig Struct Reference

#include <CUNetworkConnection.h>

Public Member Functions

 ConnectionConfig ()
 
 ConnectionConfig (const std::string punchthroughServerAddr, uint16_t punchthroughServerPort, uint32_t maxPlayers, uint8_t apiVer)
 

Public Attributes

std::string punchthroughServerAddr
 
uint16_t punchthroughServerPort
 
uint32_t maxNumPlayers
 
uint8_t apiVersion
 

Detailed Description

The basic data needed to setup a connection.

You must run an external NAT punchthrough server to use the connection class. To setup a NAT punchthrough server of your own, see:

https://github.com/mt-xing/nat-punchthrough-server

Constructor & Destructor Documentation

◆ ConnectionConfig() [1/2]

cugl::NetworkConnection::ConnectionConfig::ConnectionConfig ( )
inline

Creates a placeholder connection configuration

◆ ConnectionConfig() [2/2]

cugl::NetworkConnection::ConnectionConfig::ConnectionConfig ( const std::string  punchthroughServerAddr,
uint16_t  punchthroughServerPort,
uint32_t  maxPlayers,
uint8_t  apiVer 
)
inline

Creates a connection configuration for your game

Parameters
punchthroughServerAddrThe URL for the punchthrough server
punchthroughServerPortThe port for the punchthrough server
maxPlayersThe maximum number of players to support
apiVerThe API version number for compatibility

Member Data Documentation

◆ apiVersion

uint8_t cugl::NetworkConnection::ConnectionConfig::apiVersion

The API version number.

Clients with mismatched versions will be prevented from connecting to each other. Start this at 0 and increment it every time a backwards incompatible API change happens.

◆ maxNumPlayers

uint32_t cugl::NetworkConnection::ConnectionConfig::maxNumPlayers

Maximum number of players allowed per game (including host)

◆ punchthroughServerAddr

std::string cugl::NetworkConnection::ConnectionConfig::punchthroughServerAddr

Address of the NAT Punchthrough server

◆ punchthroughServerPort

uint16_t cugl::NetworkConnection::ConnectionConfig::punchthroughServerPort

Port to connect on the NAT Punchthrough server


The documentation for this struct was generated from the following file: