CUGL 2.1
Cornell University Game Library
|
#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 |
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
|
inline |
Creates a placeholder connection configuration
|
inline |
Creates a connection configuration for your game
punchthroughServerAddr | The URL for the punchthrough server |
punchthroughServerPort | The port for the punchthrough server |
maxPlayers | The maximum number of players to support |
apiVer | The API version number for compatibility |
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.
uint32_t cugl::NetworkConnection::ConnectionConfig::maxNumPlayers |
Maximum number of players allowed per game (including host)
std::string cugl::NetworkConnection::ConnectionConfig::punchthroughServerAddr |
Address of the NAT Punchthrough server
uint16_t cugl::NetworkConnection::ConnectionConfig::punchthroughServerPort |
Port to connect on the NAT Punchthrough server