The behavior of a session can be adjusted according to the application.
You can change the values of settings related to session processing behavior, such as the maximum allowed quiet time. To change the value of a setting, specify the value you want to set in the corresponding member of the StartupSetting structure that is passed to Session::Startup. You can change the following settings.
When changing values on the application side, ensure that the settings between each station do not differ.
When calling Session::Startup without changing any of the StartupSetting values, the default values are used for each setting. The default settings are as follows.
The maximum quiet time and keep-alive send interval settings may have a direct effect on packet-loss tolerance, depending on the specifications of the application.
For example, if the default settings are 10 seconds for maximum quiet time and one second for the keep-alive send interval, and the application does not send anything for a set period of time and the packets are lost for 10 consecutive keep-alives with that station, the station is determined to be disconnected.
However, if the application is designed to communicate with stations at shorter intervals than the keep-alive send interval, the system does not send keep-alive packets.
// Configured at session startup.
// Example change in settings. const u32 APP_MAX_SILENCE_TIME = 15000; //Maximum time without communication: 15000 (milliseconds) const u32 APP_KEEP_ALIVE_SENDING_INTERVAL = 3000; // Keep-alive interval: 3000 (milliseconds) // The setting for the name associated with the local station (the name shown in the game screen). nn::pia::transport::Station::PlayerName playerName; // Set a name of up to 16 characters, together with the language code. // In the sample demo, the name of the Mii character is set as an example. GetLocalPlayerName(&playerName); // Startup setting. nn::pia::session::Session::StartupSetting startupSetting; startupSetting.bUsingHostMigration = true; // Host migration setting. startupSetting.pPlayerName = &playerName; // Player name to use for communication. startupSetting.maxSilenceTime = APP_MAX_SILENCE_TIME; // Maximum time without communication. startupSetting.keepAliveSendingInterval = APP_KEEP_ALIVE_SENDING_INTERVAL; // Interval for sending the keep-alive signal. // Startup. result = nn::pia::session::Session::GetInstance()->Startup(startupSetting); if (result.IsFailure()) { // Error processing. } /* Go to process to build or join a session. */ |