CTR Pia  4.11.3
Game Communication Engine
nn::pia::session::Session Class Reference

This class contains processes for matchmaking and for creating and joining sessions used for P2P communication. More...

+ Inheritance diagram for nn::pia::session::Session:

Classes

struct  DebugSetting
 (For debugging.) This structure stores the debug feature settings that are passed to nn::pia::session::Session::SetDebugSetting. More...
 
struct  Setting
 Stores parameters passed to the nn::pia::session::Session::CreateInstance() function. More...
 
struct  StartupSetting
 This structure stores settings passed to nn::pia::session::Session::Startup. More...
 
class  StationIdConstIterator
 An iterator for accessing valid StationId objects in a session (const version). More...
 
class  StationIdIterator
 An iterator for accessing valid StationId objects in a session (non-const version). More...
 

Public Types

typedef bool(* JoiningApprovalCallback) (const nn::pia::transport::Station::IdentificationToken *pRequesterToken)
 Declares the type of the callback function for the session host to invoke when determining whether to approve join requests from clients. More...
 
typedef void(* SessionEventCallback) (SessionEventType eventType, StationId id)
 This callback function type is called when the session state changes. More...
 

Public Member Functions

Finish Initialization
nn::Result Startup (StartupSetting &startupSetting)
 Executes the startup procedure. More...
 
void Cleanup ()
 Executes the cleanup procedure. More...
 
Session Operations
nn::Result JoinRandomSessionAsync (CreateSessionSetting *pCreateSessionSetting, SessionSearchCriteria *pSearchCriteria, size_t criteriaNum)
 Creates or joins a session using random matchmaking. More...
 
bool IsCompletedJoinRandomSession () const
 Checks the completion of JoinRandomSessionAsync asynchronous processing. More...
 
nn::Result GetJoinRandomSessionResult () const
 Gets the result of JoinRandomSessionAsync asynchronous process. More...
 
nn::Result CancelJoinRandomSessionAsync ()
 Cancels JoinRandomSessionAsync asynchronous processes. More...
 
nn::Result BrowseSessionAsync (SessionSearchCriteria *pSearchCriteria)
 Searches for sessions. More...
 
bool IsCompletedBrowseSession () const
 Checks the completion of BrowseSessionAsync asynchronous processing. More...
 
nn::Result GetBrowseSessionResult () const
 Gets the result of BrowseSessionAsync asynchronous processing. More...
 
session::ISessionInfoListGetBrowsedSessionInfoList ()
 Gets the list of sessions that were found by the BrowseSessionAsync asynchronous process. More...
 
nn::Result CreateSessionAsync (CreateSessionSetting *pCreateSessionSetting)
 Creates a session. More...
 
bool IsCompletedCreateSession () const
 Checks the completion of CreateSessionAsync asynchronous processing. More...
 
nn::Result GetCreateSessionResult () const
 Gets the result of CreateSessionAsync asynchronous processing. More...
 
nn::Result JoinSessionAsync (const JoinSessionSetting *pJoinSessionSetting)
 Joins a session. More...
 
bool IsCompletedJoinSession () const
 Checks the completion of JoinSessionAsync asynchronous processing. More...
 
nn::Result GetJoinSessionResult () const
 Gets the result of JoinSessionAsync asynchronous processing. More...
 
nn::Result CancelJoinSessionAsync ()
 Cancels JoinSessionAsync asynchronous processes. More...
 
nn::Result LeaveSessionAsync ()
 Leaves a session. More...
 
bool IsCompletedLeaveSession () const
 Checks the completion of LeaveSessionAsync asynchronous processing. More...
 
nn::Result GetLeaveSessionResult () const
 Gets the result of LeaveSessionAsync asynchronous processing. More...
 
nn::Result OpenParticipationAsync ()
 Starts accepting participants in the session. More...
 
bool IsCompletedOpenParticipation () const
 Checks the completion of OpenParticipationAsync asynchronous processing. More...
 
nn::Result GetOpenParticipationResult () const
 Gets the result of OpenParticipationAsync asynchronous processing. More...
 
nn::Result OpenSessionAsync ()
 Starts accepting participants in the session. More...
 
bool IsCompletedOpenSession () const
 Checks for completion of the OpenSessionAsync asynchronous process. More...
 
nn::Result GetOpenSessionResult () const
 Gets the result of the OpenSessionAsync asynchronous process. More...
 
nn::Result CloseParticipationAsync ()
 Closes a session to new participants. More...
 
bool IsCompletedCloseParticipation () const
 Checks the completion of CloseParticipationAsync asynchronous processing. More...
 
nn::Result GetCloseParticipationResult () const
 Gets the result of CloseParticipationAsync asynchronous processing. More...
 
nn::Result CloseSessionAsync ()
 Closes a session to new participants. More...
 
bool IsCompletedCloseSession () const
 Checks the completion of CloseSessionAsync asynchronous processing. More...
 
nn::Result GetCloseSessionResult () const
 Gets the result of CloseSessionAsync asynchronous processing. More...
 
nn::Result GenerateSystemPasswordAsync (wchar_t *pSystemPassword)
 Generates a system password on the server and sets the password on the session. More...
 
bool IsCompletedGenerateSystemPassword () const
 Checks the completion of GenerateSystemPasswordAsync asynchronous processing. More...
 
nn::Result GetGenerateSystemPasswordResult () const
 Gets the result of GenerateSystemPasswordAsync asynchronous processing. More...
 
void GetSessionSystemPassword (wchar_t *pSystemPassword)
 Gets the system password that was set on the session with GenerateSystemPasswordAsync. More...
 
nn::Result ClearSystemPasswordAsync ()
 This function clears the system password that was set on the session. More...
 
bool IsCompletedClearSystemPassword () const
 Checks the completion of ClearSystemPasswordAsync asynchronous processing. More...
 
nn::Result GetClearSystemPasswordResult () const
 Gets the result of ClearSystemPasswordAsync asynchronous processing. More...
 
nn::Result ModifyAttributeAsync (u32 attributeIndex, u32 newValue)
 Updates the specified session search attribute. More...
 
bool IsCompletedModifyAttribute () const
 Checks the completion of ModifyAttributeAsync asynchronous processing. More...
 
nn::Result GetModifyAttributeResult () const
 Gets the result of ModifyAttributeAsync asynchronous processing. More...
 
nn::Result UpdateSessionSettingAsync (UpdateSessionSetting *pUpdateSessionSetting)
 Updates the specified session settings. More...
 
bool IsCompletedUpdateSessionSetting () const
 Checks the completion of UpdateSessionSettingAsync asynchronous processing. More...
 
nn::Result GetUpdateSessionSettingResult () const
 Gets the result of UpdateSessionSettingAsync asynchronous processing. More...
 
nn::Result UpdateApplicationDataAsync (const void *pApplicationData, size_t dataSize)
 Updates application-defined data. More...
 
bool IsCompletedUpdateApplicationData () const
 Checks the completion of UpdateApplicationDataAsync asynchronous processing. More...
 
nn::Result GetUpdateApplicationDataResult () const
 Gets the result of UpdateApplicationDataAsync asynchronous processing. More...
 
nn::Result UpdateSelectionPriority (u8 priority) const
 Updates the matchmaking priority when a session with the same requirements is found. More...
 
bool IsUpdatableSelectionPriority (u8 priority) const
 Returns whether UpdateSelectionPriority can be used for the value being updated. More...
 
Analyzing Session Information
bool IsHost () const
 Gets whether the local station is the session host. More...
 
bool CheckStationIdIsValid (nn::pia::StationId id) const
 */ More...
 
StationId GetLocalStationId () const
 Gets the StationId that represents the local station in the session. More...
 
StationId GetHostStationId () const
 Gets the StationId that represents the host of the session where the local station is a participant. More...
 
nn::Result GetLocalStationConnectionInfo (transport::StationConnectionInfo *pInfoOut)
 Gets the StationConnectionInfo that specifies the local device. More...
 
nn::Result GetHostStationConnectionInfo (transport::StationConnectionInfo *pInfoOut)
 Gets the StationConnectionInfo that represents the host of the session where the local station is a participant. More...
 
u16 GetStationNum () const
 Gets the number of valid stations connected to the current session. More...
 
u16 GetMatchmakeSessionParticipantNum () const
 Gets the number of stations currently participating in the matchmaking session. More...
 
u16 GetValidStationIdNum () const
 Gets the number of valid StationId instances in the session. More...
 
nn::Result CheckConnectionError () const
 Checks whether communication is possible with the session. More...
 
Status GetStatus () const
 Gets a Status object that specifies the status of the session. More...
 
bool IsCompleteBitRateCheck ()
 Determines whether the bitrate value may be found using the bitrate detection feature. More...
 
nn::Result GetUplinkBitRate (s32 *pBps)
 Gets the uplink bitrate of the connection measured by the bitrate detection feature. More...
 
u32 GetSessionId () const
 Gets the session ID. More...
 
u32 GetSessionId (StationId id) const
 Gets the session ID for the session in which the station with the specified station ID is participating. More...
 
StationIdIterator Begin ()
 Gets an iterator for the valid StationId objects in the session (non-const version). More...
 
StationIdIterator End ()
 Gets an iterator for the valid StationId objects in the session (non-const version). More...
 
StationIdConstIterator Begin () const
 Gets an iterator for the valid StationId objects in the session (non-const version). More...
 
StationIdConstIterator End () const
 Gets an iterator for the valid StationId objects in the session (non-const version). More...
 
Joint Session Feature
nn::Result JoinRandomJointSessionAsync (CreateSessionSetting *pCreateSessionSetting, SessionSearchCriteria *pSearchCriterias, size_t criteriaNum)
 Joins a joint session by using random matchmaking. More...
 
bool IsCompletedJoinRandomJointSession () const
 Checks the completion of JoinRandomJointSessionAsync asynchronous processing. More...
 
nn::Result GetJoinRandomJointSessionResult () const
 Gets the result of JoinRandomJointSessionAsync asynchronous process. More...
 
nn::Result DestroyJointSessionAsync ()
 Disbands a joint session. More...
 
bool IsCompletedDestroyJointSession () const
 Checks the completion of DestroyJointSessionAsync asynchronous processing. More...
 
nn::Result GetDestroyJointSessionResult () const
 Gets the result of DestroyJointSessionAsync asynchronous processing. More...
 
nn::Result OpenJointSessionParticipationAsync ()
 Starts accepting participants in the joint session. More...
 
bool IsCompletedOpenJointSessionParticipation () const
 Checks for completion of the OpenJointSessionParticipationAsync asynchronous process. More...
 
nn::Result GetOpenJointSessionParticipationResult () const
 Gets the result of the OpenJointSessionParticipationAsync asynchronous process. More...
 
nn::Result OpenJointSessionAsync ()
 Starts accepting participants in the joint session. More...
 
bool IsCompletedOpenJointSession () const
 Checks the completion of OpenJointSessionAsync asynchronous processing. More...
 
nn::Result GetOpenJointSessionResult () const
 Gets the result of OpenJointSessionAsync asynchronous processing. More...
 
nn::Result CloseJointSessionParticipationAsync ()
 Closes a joint session to new participants. More...
 
bool IsCompletedCloseJointSessionParticipation () const
 Checks for completion of the CloseJointSessionParticipationAsync asynchronous process. More...
 
nn::Result GetCloseJointSessionParticipationResult () const
 Gets the result of the CloseJointSessionParticipationAsync asynchronous process. More...
 
nn::Result CloseJointSessionAsync ()
 Closes a joint session to new participants. More...
 
bool IsCompletedCloseJointSession () const
 Checks the completion of CloseJointSessionAsync asynchronous processing. More...
 
nn::Result GetCloseJointSessionResult () const
 Gets the result of CloseJointSessionAsync asynchronous processing. More...
 
nn::Result ModifyJointSessionAttributeAsync (u32 attributeIndex, u32 newValue)
 Updates the joint session search conditions. More...
 
bool IsCompletedModifyJointSessionAttribute () const
 Checks the completion of ModifyJointSessionAttributeAsync asynchronous processing. More...
 
nn::Result GetModifyJointSessionAttributeResult () const
 Gets the result of ModifyJointSessionAttributeAsync asynchronous processing. More...
 
nn::Result UpdateJointSessionSettingAsync (UpdateSessionSetting *pUpdateSessionSetting)
 Updates the joint session settings. More...
 
bool IsCompletedUpdateJointSessionSetting () const
 Checks the completion of UpdateJointSessionSettingAsync asynchronous processing. More...
 
nn::Result GetUpdateJointSessionSettingResult () const
 Gets the result of UpdateJointSessionSettingAsync asynchronous processing. More...
 
nn::Result UpdateJointSessionApplicationDataAsync (const void *pApplicationBuffer, size_t dataSize)
 Updates joint session application-defined data. More...
 
bool IsCompletedUpdateJointSessionApplicationData () const
 Checks the completion of UpdateJointSessionApplicationDataAsync asynchronous processing. More...
 
nn::Result GetUpdateJointSessionApplicationDataResult () const
 Gets the result of UpdateJointSessionApplicationDataAsync asynchronous processing. More...
 
u32 GetJointSessionId () const
 Gets the ID of the joint session. More...
 
bool IsJointSessionHost () const
 Gets whether the local station is the joint session host. More...
 
StationId GetJointSessionHostStationId () const
 Gets the StationId that represents the joint session host. More...
 
nn::Result GetJointSessionHostStationConnectionInfo (transport::StationConnectionInfo *pInfoOut)
 Gets the StationConnectionInfo that represents the host of the joint session where the local station is a participant. More...
 
Registering and Unregistering Callback Functions
nn::Result RegisterSessionEventCallback (SessionEventCallback callback)
 Registers the callback function that is called when the session state changes. More...
 
void UnregisterSessionEventCallback ()
 Unregisters the callback function registered for changes to the session state. More...
 
void RegisterJoiningApprovalCallback (JoiningApprovalCallback callback)
 Registers the callback function for determining whether to approve or deny a join request when received by the session host. More...
 
void UnregisterJoiningApprovalCallback ()
 Unregisters the callback function that is called to determine whether to approve or deny a join request. More...
 
Synchronous Clock
s64 GetTime (void) const
 Specifies the synchronous clock (the time, in milliseconds, since the session was created). More...
 
void SetSyncClockPulseInterval (s32 interval)
 Specifies the send interval of the synchronization pulse for the synchronous clock. More...
 
s32 GetSyncClockPulseInterval (void) const
 Gets the send interval of the synchronization pulse for the synchronous clock. More...
 
Relay Feature
nn::Result SetMaxNumOfRelayRoutesAssignedToStation (u16 num)
 Sets the maximum number of forwarding requests that can be assigned to a single station when relaying is enabled. More...
 
nn::Result SetMaxRtt (u16 rtt)
 Sets the maximum total RTT for a relay route when relaying is enabled. More...
 
nn::Result GetConnectionRoute (StationIndex targetIndex, StationIndex *pRelayIndex)
 Gets the connection path between the local station and an arbitrary station index when relaying is enabled. (For debugging.) More...
 
nn::Result RelayEmulation (StationIndex index1, StationIndex index2, Mesh::EmulationType type)
 Specifies connection path emulation settings between any two StationIndex objects when relaying is enabled. (For debugging.) More...
 
void ResetRelayEmulation ()
 Initializes connection path emulation settings when relay connections are enabled. (For debugging.) More...
 
Other
bool IsUsingHostMigration () const
 Gets whether host migration is enabled. More...
 
nn::Result KickoutStation (nn::pia::StationId id)
 Kicks a station from the mesh. (Host only.) More...
 
DisconnectReason GetSessionDisconnectReason () const
 Gets the reason why the mesh was disconnected. More...
 
virtual void Trace (u64 flag) const
 Prints information that is useful for debugging. More...
 
void SetMatchmakeAnalysisToken (nn::pia::transport::Station::IdentificationToken *pToken)
 Sets the transport::Station::IdentificationToken used to determine whether inconsistency is detected in the session participation approval callback in the matchmaking analysis feature. More...
 

Static Public Member Functions

Singleton Instance Control
static nn::Result CreateInstance (Session::Setting setting)
 Creates the Session class instance (singleton pattern). More...
 
static void DestroyInstance ()
 Frees the Session class instance (singleton pattern).
 
static SessionGetInstance ()
 Gets the Session class instance (singleton pattern). More...
 
static nn::Result SetDebugSetting (const DebugSetting &debugSetting)
 (For debugging.) Configures the Session debugging feature. More...
 

Detailed Description

This class contains processes for matchmaking and for creating and joining sessions used for P2P communication.

This class implements the singleton pattern. Only a single instance can be created.

      Some of the internal processes of the <tt>Session</tt> class are registered as jobs in <tt>@ref nn::pia::common::Scheduler</tt>
      so you must make periodic calls to <tt>@ref nn::pia::common::Scheduler::Dispatch</tt>


Revision History:

2015-06-30 Removed the session merge feature.

2015-05-20 Added the Session::GetUplinkBitRate function.

2015-05-20 Added the bitRateCheckMode member to the Setting structure to enable configuration of the bit rate detection feature.

2015-05-20 Added the uplinkBitRateLowerLimit and bitRateCheckPacketSize members to the StartupSetting structure to enable configuration of the bit rate detection feature.

2015-01-20 Added the GetMatchmakeSessionParticipantNum(), CancelJoinSessionAsync(), and CancelJoinRandomSessionAsync() functions.

2015-01-20 Added a description of the specification changes to CloseParticipationAsync.

2015-01-20 Noted that ResultGameServerProcessAborted is sometimes returned in the results of asynchronous processes related to the sessions feature.

2015-01-07 Added the GetJoinSequence() and GetJoinMeshSequence() functions.

2014-11-05 Deleted STATUS_CONNECTED_NETWORK from the return values for the GetStatus() function.

2014-11-05 Changed the CheckConnection() function to CheckConnectionError().

2014-11-05 Added EVENT_JOINT_SESSION_HOST_CHANGED.

2014-11-05 Added a feature for changing the search conditions for joint sessions.

2014-11-05 Added the GetJointSessionStationId() function.

2014-10-07 Added functions and constants related to joint session features that had been removed.

2014-09-18 Changed the specifications so that ResultAlreadyExists is returned if you call CreateInstance() when an instance already exists.

2014-08-11 Removed functions and constants related to the joint session feature, and added functions and constants related to the session merge feature.

2014-02-27 Initial version.

Member Typedef Documentation

typedef bool(* nn::pia::session::Session::JoiningApprovalCallback) (const nn::pia::transport::Station::IdentificationToken *pRequesterToken)

Declares the type of the callback function for the session host to invoke when determining whether to approve join requests from clients.

This function defines the callback that is invoked when the local station is the session host and it receives a join request from a client. The return value is used to decide whether to approve or deny the join request.

Parameters
[in]pRequesterTokenSpecifies a pointer to the ID token of the station that sent the join request.
Returns
Returns true to approve the join request, or false otherwise.
typedef void(* nn::pia::session::Session::SessionEventCallback) (SessionEventType eventType, StationId id)

This callback function type is called when the session state changes.

Parameters

  • eventType: Enumerated type indicating what the state change was. For more information, see the SessionEventType enumerated type.
  • id: The StationId of the station that changed its state.

Member Enumeration Documentation

Enumerates reasons why a Session object cannot communicate.

This information can be retrieved using the GetSessionDisconnectReason function.

Enumerator
UNKNOWN_REASON 

Specifies that the reason for the disconnection is unknown. One way to get this value is by calling the Session::Cleanup function during communication (without destroying or leaving the session).

NOT_YET_COMMUNICATED 

Specifies that no communication has been performed. You get this value if you never build or join a session after calling the Session::Startup function.

OPERATION_OF_OWN 

Specifies that the disconnection was caused by the local station. You get this value when the local station left the session by calling Session::LeaveSessionAsync or similar function.

OPERATION_OF_OTHER 

Specifies that the disconnection was caused by another station in the session. One way to get this value is when the local station is a client, and the host destroys the session.

KICKOUT_BY_USER 

Specifies that the local station was kicked out from the session because of a call to the Session::KickoutStation function.

KICKOUT_BY_SYSTEM 

Specifies that the disconnection from the session was caused by the library. One way to get this value is when relaying is enabled, and the library disconnects you from the session because it restricts the number of relay requests.

INCONSISTENT_INFO 

Specifies that the disconnection was caused by a desync. (The session information was no longer consistent between participants.) One way to get this value is when the station counts do not match.

MIGRATION_FAIL 

Specifies that the disconnection was caused by a failed host migration.

EXTERNAL_FACTOR 

Specifies that the disconnection was caused by something other than the session. One way to get this value is when the network connection is lost.

MIGRATION_FATAL_ERROR 

Specifies that a fatal error occurred during host migration. This error can occur when the library detects that a session has broken up.

This enumerated type is passed as a parameter to the callback that sends notifications about changes in the session state.

It represents the possible changes to the session state.

Enumerator
EVENT_JOIN 

Indicates that a station has joined.

EVENT_LEAVE 

A station has left.

EVENT_SESSION_HOST_CHANGED 

Indicates that the host of the session has changed. (Only occurs when host migration is enabled.)

EVENT_HOST_MIGRATION_FAILED 

Indicates that host migration failed. (Only occurs when host migration is enabled.)

EVENT_JOINT_SESSION_HOST_CHANGED 

Indicates that the host of the joint session has changed. (Only occurs when using the joint session feature with host migration enabled.)

EVENT_START_SESSION_CREATE_JOINT 

Indicates that the process of creating a joint session has started. (Only occurs when using the joint session feature.)

EVENT_END_SESSION_CREATE_JOINT 

Indicates that the process of creating a joint session has finished. (Only occurs when using the joint session feature.)

EVENT_START_SESSION_JOIN_JOINT 

Indicates that the process of joining a joint session has started. (Only occurs when using the joint session feature.)

EVENT_END_SESSION_JOIN_JOINT 

Indicates that the process of joining a joint session has finished. (Only occurs when using the joint session feature.)

EVENT_START_SESSION_JOINT_RANDOM 

Indicates that a joint session has started through random matchmaking. (Only occurs when using the joint session feature.)

EVENT_END_SESSION_JOINT_RANDOM 

Indicates that a joint session started through random matchmaking has been completed. (Only occurs when using the joint session feature.)

EVENT_START_SESSION_DESTROY_JOINT 

Indicates that the process of disbanding a joint session has started. (Only occurs when using the joint session feature.)

EVENT_END_SESSION_DESTROY_JOINT 

Indicates that the process of disbanding a joint session has finished. (Only occurs when using the joint session feature.)

EVENT_START_SESSION_LEAVE_JOINT 

Indicates that the process of leaving a joint session has started. (Only occurs when using the joint session feature.)

EVENT_END_SESSION_LEAVE_JOINT 

Indicates that the process of leaving a joint session has finished. (Only occurs when using the joint session feature.)

EVENT_SESSION_MIGRATION_FAILED 

Indicates that the session migration process for the joint session feature failed. (Only occurs when using the joint session feature.)

EVENT_SET_SESSION_SYSTEM_PASSWORD 

A system password was set on the session.

EVENT_CLEAR_SESSION_SYSTEM_PASSWORD 

The system password of the session was cleared.

Enumerates session states.

This information can be retrieved using the Session::GetStatus function.

Enumerator
STATUS_NOT_CONNECTED 

Not communicating.

STATUS_CONNECTED_SESSION 

Joined a session.

STATUS_MIGRATING_SESSION 

Being transferred to a session by the joint session feature. (Includes a period with no communication.)

STATUS_CONNECTED_JOINT_SESSION 

Joined a joint session.

STATUS_DISCONNECTED_SESSION 

Disconnected from the session. Call Cleanup after calling LeaveSessionAsync.

STATUS_DISCONNECTED_NETWORK 

Disconnected from the network. Log out and then log in again.

Member Function Documentation

StationIdIterator nn::pia::session::Session::Begin ( )
inline

Gets an iterator for the valid StationId objects in the session (non-const version).

Returns
Returns an iterator that points to the start of a list of StationId objects that are valid at the time the function is called.
See also
End
StationIdConstIterator nn::pia::session::Session::Begin ( ) const
inline

Gets an iterator for the valid StationId objects in the session (non-const version).

Returns
Returns an iterator that points to the start of a list of StationId objects that are valid at the time the function is called.
See also
End
nn::Result nn::pia::session::Session::BrowseSessionAsync ( SessionSearchCriteria pSearchCriteria)

Searches for sessions.

This function starts an asynchronous process that searches for sessions. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedBrowseSession to check whether the process has completed and GetBrowseSessionResult to check the result. If the search process succeeds, the list of browsable sessions is updated and can be retrieved by calling GetBrowsedSessionInfoList.

Parameters
[in]pSearchCriteriaSpecifies the search criteria to use when searching for sessions.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedBrowseSession, GetBrowseSessionResult, GetBrowsedSessionInfoList
nn::Result nn::pia::session::Session::CancelJoinRandomSessionAsync ( )

Cancels JoinRandomSessionAsync asynchronous processes.

This function cancels asynchronous processes started by JoinRandomSessionAsync. The cancel process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. The library quickly acts to cancel the asynchronous process after this function is called, but check using the IsCompletedJoinRandomSession() function that the cancellation has completed.

Returns
Returns the result of canceling JoinRandomSessionAsync asynchronous processing. On success, returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:
ResultInvalidState Returned when no JoinRandomSessionAsync asynchronous processing is being performed. Programming error. Fix your program so that this error is not returned.
See also
JoinRandomSessionAsync, IsCompletedJoinRandomSession, GetJoinRandomSessionResult
nn::Result nn::pia::session::Session::CancelJoinSessionAsync ( )

Cancels JoinSessionAsync asynchronous processes.

This function cancels asynchronous processes started by JoinSessionAsync. The cancel process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. The library quickly acts to cancel the asynchronous process after this function is called, but check using the IsCompletedJoinSession() function that the cancellation has completed.

Returns
Returns the result of canceling JoinSessionAsync asynchronous processing. On success, returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:
ResultInvalidState Returned when no JoinSessionAsync asynchronous processing is being performed. Programming error. Fix your program so that this error is not returned.
See also
JoinSessionAsync, IsCompletedJoinSession, GetJoinSessionResult
nn::Result nn::pia::session::Session::CheckConnectionError ( ) const

Checks whether communication is possible with the session.

The Result object returned by this function changes if there are any irregularities in the session or the connection. Periodically call this function to check the status.

If communication is possible, the detailed status can be retrieved using GetStatus.

If communication with the mesh becomes impossible after joining the session, the detailed reason can be checked by calling GetSessionDisconnectReason.

Returns
Returns a Result value for which the IsSuccess() function returns true if communication is possible. Otherwise, one of the following Result values is returned.
Error Return Values:

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

bool nn::pia::session::Session::CheckStationIdIsValid ( nn::pia::StationId  id) const

*/

Checks whether an arbitrary StationId within the session is currently valid.

Parameters
[in]idSpecifies the StationId being checked.
Returns
Returns true if the specified StationId is valid, or false otherwise.
void nn::pia::session::Session::Cleanup ( )

Executes the cleanup procedure.

Call this function after the session ends or an error occurs to restore the Session to a usable state. If CheckConnectionError has returned ResultSessionConnectionIsLost call LeaveSessionAsync before calling this function.

Call Startup again if you want to use your Session instance again after you have called the Cleanup function.

See also
Startup
nn::Result nn::pia::session::Session::ClearSystemPasswordAsync ( )

This function clears the system password that was set on the session.

This function cannot be used with local communications.

   This function asynchronously clears the system password that was set on the session.
   Clients are notified by the <tt>Session::EVENT_CLEAR_SESSION_SYSTEM_PASSWORD</tt> event.
   Only the session host can execute this function.
   The started process advances by periodically calling the <tt>@ref nn::pia::common::Scheduler::Dispatch</tt> function.
   Use <tt>@ref IsCompletedClearSystemPassword</tt> to check whether the process has completed and <tt>@ref GetClearSystemPasswordResult</tt> to check the result.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. This function is not supported in local communication. Programming error. Fix your program so that this error is not returned. For Internet communication, make sure that no other asynchronous processes are running, that Startup has been called, and that the local station is the host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

See also
IsCompletedClearSystemPassword, GetClearSystemPasswordResult, IsHost
nn::Result nn::pia::session::Session::CloseJointSessionAsync ( )

Closes a joint session to new participants.

This function starts an asynchronous process that closes a joint session to new participants. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedCloseJointSession to check whether the process has completed and GetCloseJointSessionResult to check the result. All stations participating in the joint session must call this function.

After it is confirmed that the numbers of matchmaking session and mesh participants match and that the stations that have completed connection have called this function, asynchronous processes finish. After it is complete, the matchmaking session enters a closed state. Advance processing under the assumption that after asynchronous processing is complete, the number of new participants will not increase.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionInvalidState Indicates that the host has called OpenJointSessionAsync. Programming error. Fix your program so that this error is not returned. For error handling in the release version, perform cleanup after calling LeaveSessionAsync.

See also
IsCompletedCloseJointSession, GetCloseJointSessionResult, IsHost
nn::Result nn::pia::session::Session::CloseJointSessionParticipationAsync ( )

Closes a joint session to new participants.

This function cannot be used with local communications. This function is only available to the joint session host. This function starts an asynchronous process that closes a joint session to new participants. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedCloseJointSessionParticipation to check whether the process has completed and GetCloseJointSessionParticipationResult to check the result.

It is possible to imagine a case where a station attempts to join the joint session immediately before this function is called and ends up joining after the asynchronous process has completed. For this reason, the asynchronous process ends after waiting for the session to close and the number of participants in the matchmaking session to match the number of participants in the mesh. The asynchronous process also ends if the numbers do not match after a certain amount of time (15 seconds). In this case, GetCloseJointSessionParticipationResult returns ResultNegligibleFault. There could be attempts to join after the asynchronous process has ended. Handle these attempts as appropriate in the application.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedCloseJointSessionParticipation, GetCloseJointSessionParticipationResult, IsJointSessionHost
nn::Result nn::pia::session::Session::CloseParticipationAsync ( )

Closes a session to new participants.

This function starts an asynchronous process that closes a session to new participants. Only the session host can execute this function. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedCloseParticipation to check whether the process has completed and GetCloseParticipationResult to check the result.

It is possible to imagine a case where some station attempts to join the session immediately before this function is called and ends up joining after the asynchronous process has completed. For this reason, the asynchronous process ends after waiting for the session to close and for the number of participants in the matchmaking session to match the number of participants in the mesh. The asynchronous process also ends if the numbers do not match after a certain amount of time (15 seconds). In this case, GetCloseParticipationResult returns ResultNegligibleFault. There could be attempts to join after the asynchronous process has ended. Handle these attempts as appropriate in the application.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedCloseParticipation, GetCloseParticipationResult, IsHost
nn::Result nn::pia::session::Session::CloseSessionAsync ( )

Closes a session to new participants.

This function starts an asynchronous process that closes a session to new participants. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedCloseSession to check whether the process has completed and GetCloseSessionResult to check the result. All stations participating in the session must call this function.

After it is confirmed that the numbers of matchmaking session and mesh participants match and that the stations that have completed connection have called this function, asynchronous processes finish. After it is complete, the matchmaking session enters a closed state. Advance processing under the assumption that after asynchronous processing is complete, the number of new participants will not increase.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionInvalidState Indicates that the host has called OpenSessionAsync. Programming error. Fix your program so that this error is not returned. For error handling in the release version, perform cleanup after calling LeaveSessionAsync.

See also
IsCompletedCloseSession, GetCloseSessionResult, IsHost
static nn::Result nn::pia::session::Session::CreateInstance ( Session::Setting  setting)
static

Creates the Session class instance (singleton pattern).

If the relay emulation feature for debugging has been set by the SetDebugSetting function, and the network topology is not set to NetworkTopology_RelayMesh, the call to this function fails.

Attention
Do not call SetDebugSetting in retail ROMs.
Parameters
[in]settingParameters to set when creating the instance.
Returns
Returns a Result value that indicates success if the instance is created successfully.
Error Return Values:

nn::pia::ResultNotInitialized Indicates that the session module is not initialized. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was created at the wrong time. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultAlreadyExists Indicates that an instance has already been created. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidArgument Indicates a problem in the parameter values or the combination thereof. Programming error. Fix your program so that this error is not returned.

nn::Result nn::pia::session::Session::CreateSessionAsync ( CreateSessionSetting pCreateSessionSetting)

Creates a session.

This function starts an asynchronous process that creates a session. The local station becomes the host of the created session. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedCreateSession to check whether the process has completed and GetCreateSessionResult to check the result.

Parameters
[in]pCreateSessionSettingSpecifies the settings to use when creating the session.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedCreateSession, GetCreateSessionResult
nn::Result nn::pia::session::Session::DestroyJointSessionAsync ( )

Disbands a joint session.

This function cannot be used with local communications. This function is only available to the joint session host. It starts an asynchronous process that disbands a joint session.

The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedDestroyJointSession to check whether the process has completed and GetDestroyJointSessionResult to check the result.

If the host starts a process to disband a joint session with this function, the companion-side processes for disbanding start automatically. To track the progress of the automatically started processes, either handle the state change event or call GetStatus and check the Status object that is returned.

Some API functions, such as those related to sending and receiving, are temporarily unavailable during the asynchronous process.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

See also
IsCompletedDestroyJointSession, GetDestroyJointSessionResult
StationIdIterator nn::pia::session::Session::End ( )
inline

Gets an iterator for the valid StationId objects in the session (non-const version).

Returns
Returns an iterator that points to the position after the last element in a list of StationId objects that are valid at the time the function is called.
See also
Begin
StationIdConstIterator nn::pia::session::Session::End ( ) const
inline

Gets an iterator for the valid StationId objects in the session (non-const version).

Returns
Returns an iterator that points to the position after the last element in a list of StationId objects that are valid at the time the function is called.
See also
Begin
nn::Result nn::pia::session::Session::GenerateSystemPasswordAsync ( wchar_t *  pSystemPassword)

Generates a system password on the server and sets the password on the session.

This function cannot be used with local communications. This function asynchronously generates a system password on the server and sets the password on the session. The configured password is stored in the pSystemPassword parameter after the asynchronous process is complete. The client is notified by the Session::EVENT_SET_SESSION_SYSTEM_PASSWORD event and can get the configured password using GetSessionSystemPassword. Only the session host can execute this function. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedGenerateSystemPassword to check whether the process has completed and GetGenerateSystemPasswordResult to check the result.

Parameters
[out]pSystemPasswordStores the system password that was set.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. This function is not supported in local communication. Programming error. Fix your program so that this error is not returned. For Internet communication, make sure that no other asynchronous processes are running, that Startup has been called, and that the local station is the host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedGenerateSystemPassword, GetGenerateSystemPasswordResult, GetSessionSystemPassword, IsHost
session::ISessionInfoList* nn::pia::session::Session::GetBrowsedSessionInfoList ( )

Gets the list of sessions that were found by the BrowseSessionAsync asynchronous process.

This function gets the session list after an asynchronous process started by BrowseSessionAsync ends and the result from GetBrowseSessionResult indicates success.

Returns
Returns a pointer to the list of sessions that were found.
See also
BrowseSessionAsync, IsCompletedBrowseSession, GetBrowseSessionResult
nn::Result nn::pia::session::Session::GetBrowseSessionResult ( ) const

Gets the result of BrowseSessionAsync asynchronous processing.

This function gets the results after an asynchronous process started by BrowseSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Returned when the asynchronous process has not completed or has not started. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultCancelled The asynchronous process that was running was canceled. Perform cleanup.

nn::pia::ResultGameServerMaintenance Indicates that the game server is under maintenance. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Execute up to the logout process from the NEX server.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultErrorOccurred An internal error occurred. This result is only returned during local communication. Perform cleanup.

See also
BrowseSessionAsync, IsCompletedBrowseSession, GetBrowsedSessionInfoList
nn::Result nn::pia::session::Session::GetClearSystemPasswordResult ( ) const

Gets the result of ClearSystemPasswordAsync asynchronous processing.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by ClearSystemPasswordAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
ClearSystemPasswordAsync, IsCompletedClearSystemPassword
nn::Result nn::pia::session::Session::GetCloseJointSessionParticipationResult ( ) const

Gets the result of the CloseJointSessionParticipationAsync asynchronous process.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by CloseJointSessionParticipationAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

nn::pia::ResultNegligibleFault A certain amount of time passed without the matchmaking sessions and number of participants matching. Handle appropriately in the application.

See also
CloseJointSessionParticipationAsync, IsCompletedCloseJointSessionParticipation
nn::Result nn::pia::session::Session::GetCloseJointSessionResult ( ) const

Gets the result of CloseJointSessionAsync asynchronous processing.

This function gets the results after an asynchronous process started by CloseJointSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. This result also can be returned when the host has disbanded a joint session and passively begun an asynchronous process. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultSessionInvalidState Indicates that the host has called OpenJointSessionAsync. CloseJointSessionAsync was not called by all stations participating in the session within 60 seconds after the function was called. Programming error. Fix your program so that this error is not returned. For error handling in the release version, perform cleanup after calling LeaveSessionAsync.

nn::pia::ResultSessionInconsistentState Indicates that the process took longer than expected to complete. If the station is a client, have it check whether the other clients have called CloseJointSessionAsync. Perform cleanup after calling LeaveSessionAsync.

See also
CloseJointSessionAsync, IsCompletedCloseJointSession
nn::Result nn::pia::session::Session::GetCloseParticipationResult ( ) const

Gets the result of CloseParticipationAsync asynchronous processing.

This function gets the results after an asynchronous process started by OpenParticipationAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

nn::pia::ResultNegligibleFault A certain amount of time passed without the matchmaking sessions and number of participants matching. Handle appropriately in the application.

See also
CloseParticipationAsync, IsCompletedCloseParticipation
nn::Result nn::pia::session::Session::GetCloseSessionResult ( ) const

Gets the result of CloseSessionAsync asynchronous processing.

This function gets the results after an asynchronous process started by CloseSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. This result also can be returned when the host has created and joined a joint session and passively begun an asynchronous process. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultSessionInvalidState Indicates that the host has called OpenSessionAsync. CloseSessionAsync was not called by all stations participating in the session within 60 seconds after the function was called. Programming error. Fix your program so that this error is not returned. For error handling in the release version, perform cleanup after calling LeaveSessionAsync.

nn::pia::ResultSessionInconsistentState Indicates that the process took longer than expected to complete. If the station is a client, have it check whether the other clients have called CloseSessionAsync. Perform cleanup after calling LeaveSessionAsync.

See also
CloseSessionAsync, IsCompletedCloseSession
nn::Result nn::pia::session::Session::GetConnectionRoute ( StationIndex  targetIndex,
StationIndex pRelayIndex 
)

Gets the connection path between the local station and an arbitrary station index when relaying is enabled. (For debugging.)

This function is for debugging. Do not include it in retail products. The connection path between the local station and targetIndex is stored in pRelayIndex, according to the following rules. (The value of pRelayIndex does not change if the function could not retrieve the connection path.)

  • Direct connection: targetIndex
  • Relay connection: StationIndex of the relay requester.
  • Local station: STATION_INDEX_INVALID
  • Not connected: STATION_INDEX_INVALID

Even if you can get a valid value for the requester's StationIndex, it might not be possible to convert the value to a StationId. When this occurs, transport::Transport::ConvertToStationId returns ResultNotFound. This state is only temporary and you can convert to a StationId after the internal process advances normally.

Parameters
[in]targetIndexSpecifies the StationIndex with the connection path to retrieve.
[out]pRelayIndexSpecifies the StationIndex indicating the connection path.
Returns
Returns a Result value indicating success if the value can be retrieved successfully.
Error Return Values:

nn::pia::ResultInvalidState Indicates that relay connections are disabled. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidArgument The specified StationIndex is invalid, or the pointer specified in the arguments is invalid. Programming error. Fix your program so that this error is not returned.

nn::Result nn::pia::session::Session::GetCreateSessionResult ( ) const

Gets the result of CreateSessionAsync asynchronous processing.

This function gets the results after an asynchronous process started by CreateSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates an internal state that prevents the asynchronous process from advancing. This result is also returned when the asynchronous process has not completed or has not started. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultGameServerMaintenance Indicates that the game server is under maintenance. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Execute up to the logout process from the NEX server.

nn::pia::ResultDnsFailed DNS resolution failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultNatCheckFailed The NAT check failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultCancelled The asynchronous process was canceled. Perform cleanup.

nn::pia::ResultTimeOut Timed out. This result is only returned during local communication. Perform cleanup.

nn::pia::ResultErrorOccurred An internal error occurred. This result is only returned during local communication. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

nn::pia::ResultSessionWrongState The state of the joined session was irregular. Perform cleanup.

See also
CreateSessionAsync, IsCompletedCreateSession
nn::Result nn::pia::session::Session::GetDestroyJointSessionResult ( ) const

Gets the result of DestroyJointSessionAsync asynchronous processing.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by DestroyJointSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true if the asynchronous process succeeds. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Returns when the process cannot be made. This result is also returned when the asynchronous process has not completed or has not started. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultGameServerMaintenance Indicates that the game server is under maintenance. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Execute up to the logout process from the NEX server.

nn::pia::ResultCompanionStationIsOffline A companion client was not logged in to the game server. Perform cleanup.

nn::pia::ResultCompanionStationIsLeft Lost the connection with the companion station. Perform cleanup.

nn::pia::ResultCompanionStationDenied The companion station was not in a joint disband-ready state and denied the connection. Perform cleanup.

nn::pia::ResultSessionMigrationFailed Failed to migrate the session. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
DestroyJointSessionAsync, IsCompletedDestroyJointSession
nn::Result nn::pia::session::Session::GetGenerateSystemPasswordResult ( ) const

Gets the result of GenerateSystemPasswordAsync asynchronous processing.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by GenerateSystemPasswordAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
GenerateSystemPasswordAsync, IsCompletedGenerateSystemPassword
nn::Result nn::pia::session::Session::GetHostStationConnectionInfo ( transport::StationConnectionInfo pInfoOut)

Gets the StationConnectionInfo that represents the host of the session where the local station is a participant.

When participating in a session or a joint session, this function returns a StationConnectionInfo that specifies the session host.

Parameters
[out]pInfoOutSpecifies a pointer to the object that holds the address obtained for the session host.
Returns
Returns a Result value for which the IsSuccess() function returns true if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
Error Return Values:

ResultInvalidArgument Indicates that one or more arguments are invalid. Programming error. Fix your program so that this error is not returned.

ResultInvalidState Indicates not participating in a session. Programming error. Fix your program so that this error is not returned.

ResultTemporaryUnavailable Session transition in progress. Handle appropriately in the application.

Returns
Returns the StationConnectionInfo that represents the host of the session where the local station is a participant.
StationId nn::pia::session::Session::GetHostStationId ( ) const
inline

Gets the StationId that represents the host of the session where the local station is a participant.

This function returns STATION_ID_INVALID if the local station is not a participant in a session. When participating in a session or a joint session, this function returns a StationId that specifies the session host.

Returns
Returns the StationId that represents the host of the session where the local station is a participant.
static Session* nn::pia::session::Session::GetInstance ( void  )
inlinestatic

Gets the Session class instance (singleton pattern).

Returns a null pointer if the instance has not yet been created and initialized using the CreateInstance function.

Returns
Returns a pointer to the Session instance.
nn::Result nn::pia::session::Session::GetJoinRandomJointSessionResult ( ) const

Gets the result of JoinRandomJointSessionAsync asynchronous process.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by JoinRandomJointSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true if the asynchronous process succeeds. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the local station is not in a joint session-ready state. This result is also returned when the asynchronous process has not completed or has not started. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionIsNotFound The target session was lost or closed during the asynchronous process. Perform cleanup.

nn::pia::ResultMatchmakeSessionIsFull The target matchmaking session is full. Perform cleanup.

nn::pia::ResultDeniedByParticipants The local station is blacklisted by a session participant. Perform cleanup.

nn::pia::ResultParticipantInBlackList A participant on the local station's blacklist is in the session. Perform cleanup.

nn::pia::ResultSessionUserPasswordUnmatch The user password specified when joining does not match the user password set on the session. Perform cleanup.

nn::pia::ResultSessionSystemPasswordUnmatch The system password specified when joining does not match the system password set on the session. Perform cleanup.

nn::pia::ResultSessionIsClosed Attempted to join a session that is closed. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultHostIsNotFriend Attempted to join a session with a host that is not a friend. Perform cleanup.

nn::pia::ResultGameServerMaintenance Indicates that the game server is under maintenance. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Execute up to the logout process from the NEX server.

nn::pia::ResultCompanionStationIsOffline A companion client was not logged in to the game server. Perform cleanup.

nn::pia::ResultCompanionStationIsLeft Lost the connection with the companion station. Perform cleanup.

nn::pia::ResultCompanionStationDenied The companion station was not in a joint session-ready state and denied the connection. Perform cleanup.

nn::pia::ResultSessionMigrationFailed Failed to migrate the session. Perform cleanup.

nn::pia::ResultStationConnectionFailed The connection process failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultStationConnectionNatTraversalFailedUnknown The NAT traversal connection process failed. The NAT type is unknown. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultNatTraversalFailedBothEim The NAT traversal connection process failed. The NAT type was EIM for both the local station and the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultNatTraversalFailedLocalEimRemoteEdm The NAT traversal connection process failed. The NAT type was EIM for the local station and EDM for the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultNatTraversalFailedLocalEdmRemoteEim The NAT traversal connection process failed. The NAT type was EDM for the local station and EIM for the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultNatTraversalFailedBothEdm The NAT traversal connection process failed. The NAT type was EDM for both the local station and the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultNatTraversalRequestTimeout The NAT traversal connection process failed. The NAT traversal request timed out. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultJoinRequestDenied The mesh host denied the connection request. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultMeshIsFull Failed to join the mesh because it was full. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedNoCandidate The relay connection failed because there were no relay route candidates. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedRttLimit The relay connection failed because the relay route RTT limit was exceeded. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedRelayNumLimit The relay connection failed because the limit on the number of relay route relay requests was exceeded. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedUnknown The relay connection failed. (Details unknown.) Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultInvalidSystemMessage The process was canceled because an invalid response was received from the mesh host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultIncompatibleFormat Indicates that the peer is using an incompatible communication format. Returned when you try to communicate with a ROM that uses a different version of Pia that does not have communication compatibility. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

nn::pia::ResultSessionWrongState The state of the joined session was irregular. Perform cleanup.

See also
JoinRandomJointSessionAsync, IsCompletedJoinRandomJointSession
nn::Result nn::pia::session::Session::GetJoinRandomSessionResult ( ) const

Gets the result of JoinRandomSessionAsync asynchronous process.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by JoinRandomSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Returned when the asynchronous process has not completed or has not started. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultGameServerMaintenance Indicates that the game server is under maintenance. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Execute up to the logout process from the NEX server.

nn::pia::ResultNatCheckFailed The NAT check failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultDnsFailed DNS resolution failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost or closed during the asynchronous process. Perform cleanup.

nn::pia::ResultCancelled The asynchronous process was canceled. Perform cleanup.

nn::pia::ResultStationConnectionFailed The connection process failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultStationConnectionNatTraversalFailedUnknown The NAT traversal connection process failed. The NAT type is unknown. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalFailedBothEim The NAT traversal connection process failed. The NAT type was EIM for both the local station and the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalFailedLocalEimRemoteEdm The NAT traversal connection process failed. The NAT type was EIM for the local station and EDM for the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalFailedLocalEdmRemoteEim The NAT traversal connection process failed. The NAT type was EDM for the local station and EIM for the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalFailedBothEdm The NAT traversal connection process failed. The NAT type was EDM for both the local station and the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalRequestTimeout The NAT traversal connection process failed. The NAT traversal request timed out. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultJoinRequestDenied The session host denied the connection request. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultMeshIsFull Failed to join the mesh because it was full. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedNoCandidate The relay connection failed because there were no relay route candidates. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedRttLimit The relay connection failed because the relay route RTT limit was exceeded. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedRelayNumLimit The relay connection failed because the limit on the number of relay route relay requests was exceeded. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedUnknown The relay connection failed. (Details unknown.) Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultInvalidSystemMessage The process was canceled because an invalid response was received from the session host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultIncompatibleFormat Indicates that the peer is using an incompatible communication format. Returned when you try to communicate with a ROM that uses a different version of Pia that does not have communication compatibility. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

nn::pia::ResultSessionWrongState The state of the joined session was irregular. Perform cleanup.

See also
JoinRandomSessionAsync, IsCompletedJoinRandomSession
nn::Result nn::pia::session::Session::GetJoinSessionResult ( ) const

Gets the result of JoinSessionAsync asynchronous processing.

This function gets the results after an asynchronous process started by JoinSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Returned when the asynchronous process has not completed or has not started. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionIsNotFound The target session was lost or closed during the asynchronous process. Perform cleanup.

nn::pia::ResultMatchmakeSessionIsFull The matchmaking session is full. Perform cleanup.

nn::pia::ResultDeniedByParticipants The local station is blacklisted by a session participant. Perform cleanup.

nn::pia::ResultParticipantInBlackList A participant on the local station's blacklist is in the session. Perform cleanup.

nn::pia::ResultGameServerMaintenance Indicates that the game server is under maintenance. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Execute up to the logout process from the NEX server.

nn::pia::ResultNatCheckFailed The NAT check failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultDnsFailed DNS resolution failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Perform cleanup.

nn::pia::ResultCancelled The asynchronous process was canceled. Perform cleanup.

nn::pia::ResultInvalidState Returned when the station is not in a connection-ready state. This result is also returned when the asynchronous process has not completed or has not started. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultStationConnectionFailed The connection process failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultStationConnectionNatTraversalFailedUnknown The NAT traversal connection process failed. The NAT type is unknown. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalFailedBothEim The NAT traversal connection process failed. The NAT type was EIM for both the local station and the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalFailedLocalEimRemoteEdm The NAT traversal connection process failed. The NAT type was EIM for the local station and EDM for the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalFailedLocalEdmRemoteEim The NAT traversal connection process failed. The NAT type was EDM for the local station and EIM for the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalFailedBothEdm The NAT traversal connection process failed. The NAT type was EDM for both the local station and the peer to which the connection failed. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultNatTraversalRequestTimeout The NAT traversal connection process failed. The NAT traversal request timed out. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors. Perform cleanup.

nn::pia::ResultJoinRequestDenied The session host denied the connection request. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultMeshIsFull Failed to join the mesh because it was full. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedNoCandidate The relay connection failed because there were no relay route candidates. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedRttLimit The relay connection failed because the relay route RTT limit was exceeded. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedRelayNumLimit The relay connection failed because the limit on the number of relay route relay requests was exceeded. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultRelayFailedUnknown The relay connection failed. (Details unknown.) Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultInvalidSystemMessage The process was canceled because an invalid response was received from the session host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultSessionUserPasswordUnmatch The user password specified when joining does not match the user password set on the session. Perform cleanup.

nn::pia::ResultSessionSystemPasswordUnmatch The system password specified when joining does not match the system password set on the session. Perform cleanup.

nn::pia::ResultSessionIsClosed Attempted to join a session that is closed. Perform cleanup. Handle appropriately in the application. When an error occurs in Internet communication, If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Do not use the error/EULA applet (CTR) for local communication errors.

nn::pia::ResultHostIsNotFriend Attempted to join a session with a host that is not a friend. Perform cleanup.

nn::pia::ResultCompanionStationIsOffline A companion client was not logged in to the game server. Perform cleanup.

nn::pia::ResultIncompatibleFormat Indicates that the peer is using an incompatible communication format. Returned when you try to communicate with a ROM that uses a different version of Pia that does not have communication compatibility. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

nn::pia::ResultSessionWrongState The state of the joined session was irregular. Perform cleanup.

nn::pia::ResultTimeOut Timed out. It could also be returned when the passphrase set with nn::pia::local::UdsJoinSessionSetting is incorrect. This result is only returned during local communication. Perform cleanup.

nn::pia::ResultDifferentVersion Attempted to join a session with a different local network version or application version. This result is only returned during local communication. Perform cleanup.

nn::pia::ResultErrorOccurred An internal error occurred. This result is only returned during local communication. Perform cleanup.

See also
JoinSessionAsync, IsCompletedJoinSession
nn::Result nn::pia::session::Session::GetJointSessionHostStationConnectionInfo ( transport::StationConnectionInfo pInfoOut)

Gets the StationConnectionInfo that represents the host of the joint session where the local station is a participant.

When participating in a joint session, this function returns a StationConnectionInfo that specifies the joint session host.

Parameters
[out]pInfoOutA pointer to the object that holds the address representing the joint session host.
Returns
Returns a Result value for which the IsSuccess() function returns true if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
Error Return Values:

ResultInvalidArgument Indicates that one or more arguments are invalid. Programming error. Fix your program so that this error is not returned.

ResultInvalidState Not participating in a joint session. Programming error. Fix your program so that this error is not returned.

Returns
Returns the StationConnectionInfo that represents the host of the joint session where the local station is a participant.
StationId nn::pia::session::Session::GetJointSessionHostStationId ( ) const

Gets the StationId that represents the joint session host.

This function returns STATION_ID_INVALID if the local station is not a participant in a joint session. When participating in a joint session, this function returns a StationId that specifies the joint session host.

Returns
Returns the StationId that represents the joint session host.
u32 nn::pia::session::Session::GetJointSessionId ( ) const

Gets the ID of the joint session.

This function always returns INVALID_SESSION_ID during local communication.

Returns
Returns the session ID of the currently joined joint session. Returns INVALID_SESSION_ID if not a participant in a joint session.
nn::Result nn::pia::session::Session::GetLeaveSessionResult ( ) const

Gets the result of LeaveSessionAsync asynchronous processing.

This function gets the results after an asynchronous process started by LeaveSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running and Startup has been called. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultErrorOccurred An internal error occurred. This result is only returned during local communication. Perform cleanup.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
LeaveSessionAsync, IsCompletedLeaveSession
nn::Result nn::pia::session::Session::GetLocalStationConnectionInfo ( transport::StationConnectionInfo pInfoOut)

Gets the StationConnectionInfo that specifies the local device.

When participating in a session or a joint session, this function returns a StationConnectionInfo that represents the station itself.

Parameters
[out]pInfoOutSpecifies a pointer to the object that holds the address obtained for the session host.
Returns
Returns a Result value for which the IsSuccess() function returns true if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
Error Return Values:

ResultInvalidArgument Indicates that one or more arguments are invalid. Programming error. Fix your program so that this error is not returned.

ResultInvalidState Indicates not participating in a session. Programming error. Fix your program so that this error is not returned.

ResultTemporaryUnavailable Session transition in progress. Handle appropriately in the application.

Returns
Returns the StationConnectionInfo that specifies the local device.
StationId nn::pia::session::Session::GetLocalStationId ( ) const
inline

Gets the StationId that represents the local station in the session.

This function returns STATION_ID_INVALID if the local station is not a participant in a session.

Returns
Returns the StationId that specifies the local device.
u16 nn::pia::session::Session::GetMatchmakeSessionParticipantNum ( ) const

Gets the number of stations currently participating in the matchmaking session.

When GetStatus returns STATUS_CONNECTED_SESSION, this function returns the number of stations participating in the matchmaking session. When GetStatus returns STATUS_MIGRATING_SESSION, this function returns an undefined value, so do not call it in such cases. When GetStatus returns STATUS_CONNECTED_JOINT_SESSION, this function returns the number of stations participating in the joint matchmaking session.

Returns
Returns the number of stations participating in the matchmaking session.
nn::Result nn::pia::session::Session::GetModifyAttributeResult ( ) const

Gets the result of ModifyAttributeAsync asynchronous processing.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by ModifyAttributeAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
ModifyAttributeAsync, IsCompletedModifyAttribute
nn::Result nn::pia::session::Session::GetModifyJointSessionAttributeResult ( ) const

Gets the result of ModifyJointSessionAttributeAsync asynchronous processing.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by ModifyJointSessionAttributeAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
ModifyJointSessionAttributeAsync, IsCompletedModifyJointSessionAttribute
nn::Result nn::pia::session::Session::GetOpenJointSessionParticipationResult ( ) const

Gets the result of the OpenJointSessionParticipationAsync asynchronous process.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by OpenJointSessionParticipationAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
OpenJointSessionParticipationAsync, IsCompletedOpenJointSessionParticipation
nn::Result nn::pia::session::Session::GetOpenJointSessionResult ( ) const

Gets the result of OpenJointSessionAsync asynchronous processing.

This function gets the results after an asynchronous process started by OpenJointSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. This result also can be returned when the host has disbanded a joint session and passively begun an asynchronous process. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultSessionInvalidState Indicates that the host has called CloseJointSessionAsync. OpenJointSessionAsync was not called by all stations participating in the session within 60 seconds after the function was called. Programming error. Fix your program so that this error is not returned. For error handling in the release version, perform cleanup after calling LeaveSessionAsync.

nn::pia::ResultSessionInconsistentState Indicates that the process took longer than expected to complete. If the station is a client, make it check whether the other clients have called OpenJointSessionAsync. Perform cleanup after calling LeaveSessionAsync.

See also
OpenJointSessionAsync, IsCompletedOpenJointSession
nn::Result nn::pia::session::Session::GetOpenParticipationResult ( ) const

Gets the result of OpenParticipationAsync asynchronous processing.

This function gets the results after an asynchronous process started by OpenParticipationAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
OpenParticipationAsync, IsCompletedOpenParticipation
nn::Result nn::pia::session::Session::GetOpenSessionResult ( ) const

Gets the result of the OpenSessionAsync asynchronous process.

This function gets the results after an asynchronous process started by OpenSessionAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. This result also can be returned when the host has created and joined a joint session and passively begun an asynchronous process. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultSessionInvalidState Indicates that the host has called CloseSessionAsync. OpenSessionAsync was not called by all stations participating in the session within 60 seconds after the function was called. Programming error. Fix your program so that this error is not returned. For error handling in the release version, perform cleanup after calling LeaveSessionAsync.

nn::pia::ResultSessionInconsistentState Indicates that the process took longer than expected to complete. If the station is a client, make it check whether the other clients have called OpenSessionAsync. Perform cleanup after calling LeaveSessionAsync.

See also
OpenSessionAsync, IsCompletedOpenSession
DisconnectReason nn::pia::session::Session::GetSessionDisconnectReason ( ) const

Gets the reason why the mesh was disconnected.

This function always returns UNKNOWN_REASON if the mesh is in a state that allows for communication.

Returns
Returns a DisconnectReason value indicating the reason why the mesh disconnected.
See also
CheckConnectionError
u32 nn::pia::session::Session::GetSessionId ( ) const
inline

Gets the session ID.

Returns
Returns the session ID of the currently joined session. Returns INVALID_SESSION_ID if not a participant in a session.
u32 nn::pia::session::Session::GetSessionId ( StationId  id) const

Gets the session ID for the session in which the station with the specified station ID is participating.

This function cannot be used with local communications. Gets the session ID for the session in which the station with the specified station ID is participating.

Parameters
[in]idThe station ID.
Returns
Returns the session ID for the session in which the station with the specified station ID is participating. Returns INVALID_SESSION_ID if that station is not a participant in a session.
void nn::pia::session::Session::GetSessionSystemPassword ( wchar_t *  pSystemPassword)

Gets the system password that was set on the session with GenerateSystemPasswordAsync.

This function cannot be used with local communications. Gets the system password that was set on the session with GenerateSystemPasswordAsync. You can get the system password set for the session after Session::EVENT_SET_SESSION_SYSTEM_PASSWORD has been reported to the registered event callback.

Parameters
[out]pSystemPasswordStores the system password that was set.
See also
GenerateSystemPasswordAsync
u16 nn::pia::session::Session::GetStationNum ( ) const

Gets the number of valid stations connected to the current session.

Returns
Returns the number of connected stations.
Status nn::pia::session::Session::GetStatus ( ) const

Gets a Status object that specifies the status of the session.

The Status object returned by this function changes if there are any irregularities in the session or the connection. Periodically call this function to check the status.

Returns
Returns the current Status.
s32 nn::pia::session::Session::GetSyncClockPulseInterval ( void  ) const

Gets the send interval of the synchronization pulse for the synchronous clock.

Returns
Returns the interval at which synchronization pulses are sent. The value is in milliseconds.
See also
GetTime, SetSyncClockPulseInterval
s64 nn::pia::session::Session::GetTime ( void  ) const

Specifies the synchronous clock (the time, in milliseconds, since the session was created).

The synchronous clock is synchronized among all the stations in the session. Clients joined in the session periodically send a clock-synchronization pulse to the session host. The host then responds to these pulses, ensuring synchronization between the host and clients. By default, synchronization pulses are sent every two seconds, but the application can also change this interval. For more information, see SetSyncClockPulseInterval() and GetSyncClockPulseInterval().

Returns
Returns the elapsed time, in milliseconds, since the session was created. This function returns a negative value if the station is not synchronized with the session host, such as when it has just joined a session and not yet received a response from the host.
See also
SetSyncClockPulseInterval, GetSyncClockPulseInterval
nn::Result nn::pia::session::Session::GetUpdateApplicationDataResult ( ) const

Gets the result of UpdateApplicationDataAsync asynchronous processing.

This function gets the results after an asynchronous process started by UpdateApplicationDataAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

nn::pia::ResultGameServerMaintenance Indicates that the server is under maintenance. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Execute up to the logout process from the NEX server.

See also
UpdateApplicationDataAsync, IsCompletedUpdateApplicationData
nn::Result nn::pia::session::Session::GetUpdateJointSessionApplicationDataResult ( ) const

Gets the result of UpdateJointSessionApplicationDataAsync asynchronous processing.

This function gets the results after an asynchronous process started by UpdateJointSessionApplicationDataAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionConnectionIsLost Disconnected from the mesh. Call LeaveSessionAsync and then call Cleanup. Perform cleanup.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

nn::pia::ResultGameServerMaintenance Indicates that the server is under maintenance. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Execute up to the logout process from the NEX server.

See also
UpdateJointSessionApplicationDataAsync, IsCompletedUpdateJointSessionApplicationData
nn::Result nn::pia::session::Session::GetUpdateJointSessionSettingResult ( ) const

Gets the result of UpdateJointSessionSettingAsync asynchronous processing.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by UpdateJointSessionSettingAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
UpdateJointSessionSettingAsync, IsCompletedUpdateJointSessionSetting
nn::Result nn::pia::session::Session::GetUpdateSessionSettingResult ( ) const

Gets the result of UpdateSessionSettingAsync asynchronous processing.

This function cannot be used with local communications. This function gets the results after an asynchronous process started by UpdateSessionSettingAsync ends.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that that no other asynchronous processes are running. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionIsNotFound The target session was lost during the asynchronous process. Perform cleanup.

nn::pia::ResultNexInternalError This is an internal NEX error. The nn::pia::util::NetworkErrorCodeConverter::Convert function gets a NEX network error code. Check the NEX section of the network error code list. After logging out, reinitialize Pia and NEX. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Handle appropriately in the application.

nn::pia::ResultGameServerProcessAborted A game server-related process failed. Execute up to the logout process from the NEX server.

See also
UpdateSessionSettingAsync, IsCompletedUpdateSessionSetting
nn::Result nn::pia::session::Session::GetUplinkBitRate ( s32 *  pBps)

Gets the uplink bitrate of the connection measured by the bitrate detection feature.

Note that the value returned by this function is simply a measurement of the amount of data received over a set amount of time and does not necessarily represent the actual bandwidth of the connection. Even if the connection is capable of a high bitrate, if an application has low requirements, the amount of data sent and received during the measurement process is also small, which results in a lower bits-per-second value.

Parameters
[out]pBpsStores the measured bitrate. The value is in bits per second. A negative value is set if the bitrate could not be measured.
Returns
Returns a Result value for which the IsSuccess() function returns true if the call succeeds.
Error Return Values:

ResultNotInitialized Indicates that the instance has not been initialized. Programming error. Fix your program so that this error is not returned.

ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.

ResultInvalidState Indicates that the function was called at the wrong time. It is possible that the function was called while the bitrate detection feature was disabled. Programming error. Fix your program so that this error is not returned.

u16 nn::pia::session::Session::GetValidStationIdNum ( ) const

Gets the number of valid StationId instances in the session.

This function returns 0 if the local station is not a participant in a session.

Returns
Returns the number of valid StationId instances in the session.
bool nn::pia::session::Session::IsCompleteBitRateCheck ( )

Determines whether the bitrate value may be found using the bitrate detection feature.

Returns
Returns true if the bitrate value can be obtained. true is also returned when detection fails on a timeout, or cancel.
bool nn::pia::session::Session::IsCompletedBrowseSession ( ) const

Checks the completion of BrowseSessionAsync asynchronous processing.

This function checks the completion of asynchronous processes started with BrowseSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
BrowseSessionAsync, GetBrowseSessionResult, GetBrowsedSessionInfoList
bool nn::pia::session::Session::IsCompletedClearSystemPassword ( ) const

Checks the completion of ClearSystemPasswordAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with ClearSystemPasswordAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
ClearSystemPasswordAsync, GetClearSystemPasswordResult
bool nn::pia::session::Session::IsCompletedCloseJointSession ( ) const

Checks the completion of CloseJointSessionAsync asynchronous processing.

This function checks the completion of asynchronous processes started with CloseJointSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
CloseJointSessionAsync, GetCloseJointSessionResult
bool nn::pia::session::Session::IsCompletedCloseJointSessionParticipation ( ) const

Checks for completion of the CloseJointSessionParticipationAsync asynchronous process.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with CloseJointSessionParticipationAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
CloseJointSessionParticipationAsync, GetCloseJointSessionParticipationResult
bool nn::pia::session::Session::IsCompletedCloseParticipation ( ) const

Checks the completion of CloseParticipationAsync asynchronous processing.

This function checks the completion of asynchronous processes started with CloseParticipationAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
CloseParticipationAsync, GetCloseParticipationResult
bool nn::pia::session::Session::IsCompletedCloseSession ( ) const

Checks the completion of CloseSessionAsync asynchronous processing.

This function checks the completion of asynchronous processes started with CloseSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
CloseSessionAsync, GetCloseSessionResult
bool nn::pia::session::Session::IsCompletedCreateSession ( ) const

Checks the completion of CreateSessionAsync asynchronous processing.

This function checks the completion of asynchronous processes started with CreateSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
CreateSessionAsync, GetCreateSessionResult
bool nn::pia::session::Session::IsCompletedDestroyJointSession ( ) const

Checks the completion of DestroyJointSessionAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with DestroyJointSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
DestroyJointSessionAsync, GetDestroyJointSessionResult
bool nn::pia::session::Session::IsCompletedGenerateSystemPassword ( ) const

Checks the completion of GenerateSystemPasswordAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with GenerateSystemPasswordAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
GenerateSystemPasswordAsync, GetGenerateSystemPasswordResult
bool nn::pia::session::Session::IsCompletedJoinRandomJointSession ( ) const

Checks the completion of JoinRandomJointSessionAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with JoinRandomJointSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
JoinRandomJointSessionAsync, GetJoinRandomJointSessionResult
bool nn::pia::session::Session::IsCompletedJoinRandomSession ( ) const

Checks the completion of JoinRandomSessionAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with JoinRandomSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
JoinRandomSessionAsync, GetJoinRandomSessionResult
bool nn::pia::session::Session::IsCompletedJoinSession ( ) const

Checks the completion of JoinSessionAsync asynchronous processing.

This function checks the completion of asynchronous processes started with JoinSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
JoinSessionAsync, GetJoinSessionResult
bool nn::pia::session::Session::IsCompletedLeaveSession ( ) const

Checks the completion of LeaveSessionAsync asynchronous processing.

This function checks the completion of asynchronous processes started with LeaveSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
LeaveSessionAsync, GetLeaveSessionResult
bool nn::pia::session::Session::IsCompletedModifyAttribute ( ) const

Checks the completion of ModifyAttributeAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with ModifyAttributeAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
ModifyAttributeAsync, GetModifyAttributeResult
bool nn::pia::session::Session::IsCompletedModifyJointSessionAttribute ( ) const

Checks the completion of ModifyJointSessionAttributeAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with ModifyJointSessionAttributeAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
ModifyJointSessionAttributeAsync, GetModifyJointSessionAttributeResult
bool nn::pia::session::Session::IsCompletedOpenJointSession ( ) const

Checks the completion of OpenJointSessionAsync asynchronous processing.

This function checks the completion of asynchronous processes started with OpenJointSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
OpenJointSessionAsync, GetOpenJointSessionResult
bool nn::pia::session::Session::IsCompletedOpenJointSessionParticipation ( ) const

Checks for completion of the OpenJointSessionParticipationAsync asynchronous process.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with OpenJointSessionParticipationAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
OpenJointSessionParticipationAsync, GetOpenJointSessionParticipationResult
bool nn::pia::session::Session::IsCompletedOpenParticipation ( ) const

Checks the completion of OpenParticipationAsync asynchronous processing.

This function checks the completion of asynchronous processes started with OpenParticipationAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
OpenParticipationAsync, GetOpenParticipationResult
bool nn::pia::session::Session::IsCompletedOpenSession ( ) const

Checks for completion of the OpenSessionAsync asynchronous process.

This function checks the completion of asynchronous processes started with OpenSessionAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
OpenSessionAsync, GetOpenSessionResult
bool nn::pia::session::Session::IsCompletedUpdateApplicationData ( ) const

Checks the completion of UpdateApplicationDataAsync asynchronous processing.

This function checks the completion of asynchronous processes started with UpdateApplicationDataAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
UpdateApplicationDataAsync, GetUpdateApplicationDataResult
bool nn::pia::session::Session::IsCompletedUpdateJointSessionApplicationData ( ) const

Checks the completion of UpdateJointSessionApplicationDataAsync asynchronous processing.

This function checks the completion of asynchronous processes started with UpdateJointSessionApplicationDataAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
UpdateJointSessionApplicationDataAsync, GetUpdateJointSessionApplicationDataResult
bool nn::pia::session::Session::IsCompletedUpdateJointSessionSetting ( ) const

Checks the completion of UpdateJointSessionSettingAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with UpdateJointSessionSettingAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
UpdateJointSessionSettingAsync, GetUpdateJointSessionSettingResult
bool nn::pia::session::Session::IsCompletedUpdateSessionSetting ( ) const

Checks the completion of UpdateSessionSettingAsync asynchronous processing.

This function cannot be used with local communications. This function checks the completion of asynchronous processes started with UpdateSessionSettingAsync.

Returns
Returns true if the asynchronous process has completed, or false otherwise. Also returns false when there has been no asynchronous processing.
See also
UpdateSessionSettingAsync, GetUpdateSessionSettingResult
bool nn::pia::session::Session::IsHost ( ) const

Gets whether the local station is the session host.

This function returns whether the local station is the host of a standard session.

Returns
Returns true if the local station is the host, or false otherwise.
bool nn::pia::session::Session::IsJointSessionHost ( ) const

Gets whether the local station is the joint session host.

This function returns whether the local station is the host of the joint session.

Returns
Returns true if the local station is the host, or false otherwise.
bool nn::pia::session::Session::IsUpdatableSelectionPriority ( u8  priority) const

Returns whether UpdateSelectionPriority can be used for the value being updated.

Parameters
[in]priorityThe progress in the game to be updated.
bool nn::pia::session::Session::IsUsingHostMigration ( ) const
inline

Gets whether host migration is enabled.

The return value is determined based on the argument value specified in nn::pia::session::Session::Startup.

Returns
Returns true if nn::pia::session::Session::Startup was called with host migration enabled.
nn::Result nn::pia::session::Session::JoinRandomJointSessionAsync ( CreateSessionSetting pCreateSessionSetting,
SessionSearchCriteria pSearchCriterias,
size_t  criteriaNum 
)

Joins a joint session by using random matchmaking.

This function cannot be used with local communications. This function can only be used by the host. Starts the asynchronous process that handles joining a joint session through random matchmaking. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedJoinRandomJointSession to check whether the process has completed and GetJoinRandomJointSessionResult to check the result.

When the host starts an asynchronous process using this function, the process that handles joining a joint session through random matchmaking starts automatically on the client. To track the progress of the automatically started processes, either handle the state change event or call GetStatus and check the Status object that is returned.

Some API functions, such as those related to sending and receiving, are temporarily unavailable during the asynchronous process.

Parameters
[in]pCreateSessionSettingSpecifies a pointer to the CreateSessionSetting object that specifies the settings for the new session to create.
[in]pSearchCriteriasSpecifies a pointer to the beginning of the array of criteria to use when searching for a session.
[in]criteriaNumSpecifies the number of elements in the criteria array to use when searching for a session.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running and that the local station is the host. Programming error. Fix your program so that this error is not returned.

See also
IsCompletedJoinRandomJointSession, GetJoinRandomJointSessionResult
nn::Result nn::pia::session::Session::JoinRandomSessionAsync ( CreateSessionSetting pCreateSessionSetting,
SessionSearchCriteria pSearchCriteria,
size_t  criteriaNum 
)

Creates or joins a session using random matchmaking.

This function cannot be used with local communications. Starts an asynchronous session creation or joining process after finding a random match. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedJoinRandomSession to check whether the process has completed and GetJoinRandomSessionResult to check the result.

Multiple search criteria can be specified. The search starts from the first criteria and works its way down the list until it finds a session to join. Up to inet::SEARCH_CRITERIA_MAX_NUM search criteria can be specified. If you try to set more criteria than the maximum, nn::pia::ResultInvalidArgument is returned. Sessions that are closed or full are automatically excluded from the search. In addition, the last three sessions that the local station joined as a client are remembered by the server and excluded from the search. This record expires after one hour.

Parameters
[in]pCreateSessionSettingSpecifies the settings to use when creating a session.
[in]pSearchCriteriaSpecifies the list of search criteria to use when searching for sessions.
[in]criteriaNumSpecifies the number of criteria to use when searching for sessions.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. This function is not supported in local communication. Programming error. Fix your program so that this error is not returned. For Internet communication, make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedJoinRandomSession, GetJoinRandomSessionResult
nn::Result nn::pia::session::Session::JoinSessionAsync ( const JoinSessionSetting pJoinSessionSetting)

Joins a session.

This function starts an asynchronous process that joins a session.

The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedJoinSession to check whether the process has completed and GetJoinSessionResult to check the result.

Parameters
pJoinSessionSettingSpecifies the settings of the session to join.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Indicates that unexpected arguments were passed to the function when starting the asynchronous process. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedJoinSession, GetJoinSessionResult
nn::Result nn::pia::session::Session::KickoutStation ( nn::pia::StationId  id)

Kicks a station from the mesh. (Host only.)

This function can only be used by the host.

A kick notice is conveyed to the station assigned the StationId specified in the argument, and that station leaves the mesh upon receiving the notice.

Because of latency in transmitting the disconnect notification and other factors, there may be a delay between successfully calling this function, and the station leaving the mesh.

Parameters
[in]idSpecifies the station ID assigned to the station being kicked.
Returns
Returns a Result value for which the IsSuccess() function returns true if the station is successfully kicked from the mesh. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that a node other than the host called the function. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidArgument Indicates that the StationId specified in the arguments belongs to the mesh host, or that no station in the mesh has that ID. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInProgress Indicates that the process to kick the station having the StationId specified in the arguments has already started. Handle appropriately in the application.

nn::pia::ResultBufferIsFull Indicates that the buffer for kicking stations or the buffer for sending kick notifications is full. It may succeed if you try again after some time has passed. Handle appropriately in the application.

nn::Result nn::pia::session::Session::LeaveSessionAsync ( )

Leaves a session.

This function starts an asynchronous process that leaves a session. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedLeaveSession to check whether the process has completed and GetLeaveSessionResult to check the result.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedLeaveSession, GetLeaveSessionResult
nn::Result nn::pia::session::Session::ModifyAttributeAsync ( u32  attributeIndex,
u32  newValue 
)

Updates the specified session search attribute.

This function cannot be used with local communications.

   This function asynchronously updates the specified session search attribute.
   Only the session host can execute this function.
   The <tt><var>attributeIndex</var></tt> parameter can be set to a value between <tt>0</tt> and <tt>@ref nn::pia::inet::ATTRIBUTE_MAX_SIZE</tt> - <tt>1</tt>.
   The started process advances by periodically calling the <tt>@ref nn::pia::common::Scheduler::Dispatch</tt> function.
   Use <tt>@ref IsCompletedModifyAttribute</tt> to check whether the process has completed and <tt>@ref GetModifyAttributeResult</tt> to check the result.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument The value specified in attributeIndex is outside the allowed range. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. This function is not supported in local communication. Programming error. Fix your program so that this error is not returned. For Internet communication, make sure that no other asynchronous processes are running, that Startup has been called, and that the local station is the host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedModifyAttribute, GetModifyAttributeResult, IsHost
nn::Result nn::pia::session::Session::ModifyJointSessionAttributeAsync ( u32  attributeIndex,
u32  newValue 
)

Updates the joint session search conditions.

This function cannot be used with local communications.

   Updates the joint session search conditions.
   Only the joint session host can execute this function.
   The <tt><var>attributeIndex</var></tt> parameter can be set to a value between <tt>0</tt> and <tt>@ref nn::pia::inet::ATTRIBUTE_MAX_SIZE</tt> - <tt>1</tt>.
   The started process advances by periodically calling the <tt>@ref nn::pia::common::Scheduler::Dispatch</tt> function.
   Use <tt>@ref IsCompletedModifyJointSessionAttribute</tt> to check whether the process has completed and <tt>@ref GetModifyJointSessionAttributeResult</tt> to check the result.
Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument The value specified in attributeIndex is outside the allowed range. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. This function is not supported in local communication. Programming error. Fix your program so that this error is not returned. For Internet communication, make sure that no other asynchronous processes are running, that Startup has been called, and that the local station is the host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedModifyJointSessionAttribute, GetModifyJointSessionAttributeResult, IsJointSessionHost
nn::Result nn::pia::session::Session::OpenJointSessionAsync ( )

Starts accepting participants in the joint session.

This function starts an asynchronous process that accepts joint session participants. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedOpenJointSession to check whether the process has completed and GetOpenJointSessionResult to check the result. All stations participating in the joint session must call this function. The asynchronous process ends after it can be verified that all stations that have finished joining the session have called this function. After asynchronous processes complete, the matchmaking session is in an open state.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionInvalidState Indicates that the host has called CloseJointSessionAsync. Programming error. Fix your program so that this error is not returned. For error handling in the release version, perform cleanup after calling LeaveSessionAsync.

See also
IsCompletedOpenParticipation, GetOpenJointSessionResult, IsHost
nn::Result nn::pia::session::Session::OpenJointSessionParticipationAsync ( )

Starts accepting participants in the joint session.

This function cannot be used with local communications. This function is only available to the joint session host. This function starts an asynchronous process that accepts joint session participants. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedOpenJointSessionParticipation to check whether the process has completed and GetOpenJointSessionParticipationResult to check the result.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedOpenJointSessionParticipation, GetOpenJointSessionParticipationResult, IsJointSessionHost
nn::Result nn::pia::session::Session::OpenParticipationAsync ( )

Starts accepting participants in the session.

This function starts an asynchronous process that accepts participants. Only the session host can execute this function. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedOpenParticipation to check whether the process has completed and GetOpenParticipationResult to check the result.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

See also
IsCompletedOpenParticipation, GetOpenParticipationResult, IsHost
nn::Result nn::pia::session::Session::OpenSessionAsync ( )

Starts accepting participants in the session.

This function starts an asynchronous process that accepts participants. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedOpenSession to check whether the process has completed and GetOpenSessionResult to check the result. All stations participating in the session must call this function. The asynchronous process ends after it can be verified that all stations that have finished joining the session have called this function. After asynchronous processes complete, the matchmaking session is in an open state.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that communication is not already taking place. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultSessionInvalidState Indicates that the host has called CloseSessionAsync. Programming error. Fix your program so that this error is not returned. For error handling in the release version, perform cleanup after calling LeaveSessionAsync.

See also
IsCompletedOpenSession, GetOpenSessionResult, IsHost
void nn::pia::session::Session::RegisterJoiningApprovalCallback ( JoiningApprovalCallback  callback)

Registers the callback function for determining whether to approve or deny a join request when received by the session host.

This function defines the callback that is invoked when the local station is the session host and it receives a join request from a client. The callback function is called by nn::pia::common::Scheduler::Dispatch. Do not include any processes that block for long periods of time in the registering function.

Parameters
[in]callbackSpecifies a pointer to the callback function being registered.
See also
UnregisterJoiningApprovalCallback
nn::Result nn::pia::session::Session::RegisterSessionEventCallback ( SessionEventCallback  callback)

Registers the callback function that is called when the session state changes.

This function registers the callback that is called when the session state changes (when a station joins or exits). Do not include any processes that block for long periods of time in the registering function.

Parameters
[in]callbackSpecifies a pointer to the callback function being registered.
Returns
Returns a Result value for which the IsSuccess() function returns true if the process succeeds. If this function call fails, one or more of the following Result values is returned.
Error Return Values:
nn::pia::ResultInvalidState Returned when an event notification callback is already registered. Programming error. Fix your program so that this error is not returned.
See also
UnregisterSessionEventCallback
nn::Result nn::pia::session::Session::RelayEmulation ( StationIndex  index1,
StationIndex  index2,
Mesh::EmulationType  type 
)

Specifies connection path emulation settings between any two StationIndex objects when relaying is enabled. (For debugging.)

This function is for debugging. Do not include it in retail products.

When you call this function, make sure that you have enabled the connection path emulation feature by using the Session::SetDebugSetting function.

If EMULATION_TYPE_RELAY is set, the connection method for the target StationIndex is always a relay connection (even when, for example, a direct connection is possible).

Call this function when the terminal is not connected to a session. If you call this function when the terminal has already joined a session, there is no guarantee that changing the connection path emulation settings will work.

Parameters
[in]index1Specifies the first StationIndex.
[in]index2Specifies the first StationIndex.
[in]typeSpecifies the connection method emulation setting.
Returns
Returns a Result value indicating success if the setting succeeds.
Error Return Values:

nn::pia::ResultInvalidState Indicates that relay connections are disabled. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidArgument Indicates that the StationIndex is invalid, or the specified EmulationType is invalid. Programming error. Fix your program so that this error is not returned.

See also
SetDebugSetting, ResetRelayEmulation
void nn::pia::session::Session::ResetRelayEmulation ( )

Initializes connection path emulation settings when relay connections are enabled. (For debugging.)

This function is for debugging. Do not include it in retail products.

All connections are initialized to use the connection path emulation configured by the RelayEmulation function. (This is equivalent to setting EMULATION_TYPE_NONE for all combinations of StationIndex.)

Call this function when the terminal is not connected to a session. If you call this function when the terminal has already joined a session, there is no guarantee that changing the connection path emulation settings will work.

See also
SetDebugSetting, RelayEmulation
static nn::Result nn::pia::session::Session::SetDebugSetting ( const DebugSetting debugSetting)
static

(For debugging.) Configures the Session debugging feature.

This function can be called while the Session instance does not exist. Call this function before creating the Session instance with CreateInstance.

If the isEnableRelayEmulation member of the DebugSetting structure is set to true, the Session will be configured to use the relay emulation feature for debugging. When the session is configured to use the relay emulation feature, the CreateInstance function will not succeed unless the network topology is set to NetworkTopology_RelayMesh.

If the isEnableMatchmakeAnalysis member of the DebugSetting structure is set to true, the Session will be configured to use the matchmaking analysis feature.

If this function is not called, all related debugging features are disabled.

Attention
Do not call this function in retail ROMs.
Returns
Returns the result of the function. On success, returns a Result value for which the IsSuccess() function returns true. You must make sure that the implementation of this function in your application does not return any errors. If this function call fails, one or more of the following Result values is returned.
Error Return Values:
nn::pia::ResultInvalidState Indicates that the function cannot be executed in this state. This result is returned when the Session instance has already been created. Programming error. Fix your program so that this error is not returned.
void nn::pia::session::Session::SetMatchmakeAnalysisToken ( nn::pia::transport::Station::IdentificationToken pToken)

Sets the transport::Station::IdentificationToken used to determine whether inconsistency is detected in the session participation approval callback in the matchmaking analysis feature.

Parameters
[in]pTokenToken used to determine whether inconsistency is detected in the session participation approval callback.
nn::Result nn::pia::session::Session::SetMaxNumOfRelayRoutesAssignedToStation ( u16  num)

Sets the maximum number of forwarding requests that can be assigned to a single station when relaying is enabled.

The library uses this value as a metric when searching for and selecting relay paths. If you do not set a value, the library uses [MaximumSessionParticipants] × [MaximumSessionParticipants] as the default.

We recommend that you set this to the same value for all participants in a session. (Operation is not guaranteed if different values are set on different clients.)

This function is only available when the network topology allows relaying, and Startup has not yet been called.

Parameters
[in]numSpecifies the maximum value.
Returns
Returns a Result value indicating success if the setting succeeds.
Error Return Values:
nn::pia::ResultInvalidState Indicates that relay connections are disabled or the Startup function has already been called. Programming error. Fix your program so that this error is not returned.
nn::Result nn::pia::session::Session::SetMaxRtt ( u16  rtt)

Sets the maximum total RTT for a relay route when relaying is enabled.

The library uses this value as a metric when searching for and selecting relay paths. If you do not set a value, the library uses the default value of nn::pia::session::NN_PIA_SESSION_MAX_RTT_DEFAULT.

We recommend that you set this to the same value for all participants in a session. (Operation is not guaranteed if different values are set on different clients.)

This function is only available when the network topology allows relaying, and Startup has not yet been called.

Parameters
[in]rttSpecifies the maximum value. The value is in milliseconds.
Returns
Returns a Result value indicating success if the setting succeeds.
Error Return Values:
nn::pia::ResultInvalidState Indicates that relay connections are disabled or the Startup function has already been called. Programming error. Fix your program so that this error is not returned.
void nn::pia::session::Session::SetSyncClockPulseInterval ( s32  interval)

Specifies the send interval of the synchronization pulse for the synchronous clock.

Parameters
[in]intervalSpecifies the interval at which the synchronization pulse is sent. The value is in milliseconds.
See also
GetTime, GetSyncClockPulseInterval
nn::Result nn::pia::session::Session::Startup ( StartupSetting startupSetting)

Executes the startup procedure.

Call this function after the session::EndSetup() function has been called and the Session initialization process has ended.

The use of host migration is set by the <tt>bUsingHostMigration</tt> member of the <tt>StartupSetting</tt> structure. Set to <tt>true</tt> to enable. The default is <tt>true</tt>.
Specify the name and language code associated with the local station in the <tt>pPlayerName</tt> member of <tt>StartupSetting</tt>. The name must be no longer than 16 characters (not including the terminating null character).
    Specify a language code if your application determines the languages of other regions. You can use the value returned by the <tt>nn::cfg::CTR::GetLanguage()</tt> function if you want to use the language setting of the system.

You can set the communication encryption mode in the <tt>cryptoMode</tt> member of the <tt>StartupSetting</tt> structure. The default value is <tt>common::CryptoSetting::MODE_NOTHING</tt>.
You do not need to configure encryption for local communication because the data is encrypted in the UDS communication layer of the SDK.

Specify the maximum allowable time without communication in the <tt>maxSilenceTime</tt> member of <tt>StartupSetting</tt>. If the period without communication with the station exceeds the specified period, that station is treated as disconnected.
Specify the keep-alive send interval in the <tt>keepAliveSendingInterval</tt> member of the <tt>StartupSetting</tt> structure. Keep alive is a feature that keeps connections alive during periods of no communication by having the system send data to stations the application is not sending data to.

The default values for the <tt>maxSilenceTime</tt> and <tt>keepAliveSendingInterval</tt> members of <tt>StartupSetting</tt> are as follows. (These values are used if you do not modify the <tt>maxSilenceTime</tt> and <tt>keepAliveSendingInterval</tt> members of <tt>StartupSetting</tt>.)
<ul>
<li> <tt>maxSilenceTime</tt>: <tt>nn::pia::session::NN_PIA_SESSION_MAX_SILENCE_TIME_DEFAULT</tt></li>
<li> <tt>keepAliveSendingInterval</tt>: <tt>nn::pia::session::NN_PIA_SESSION_KEEP_ALIVE_INTERVAL_DEFAULT</tt></li>
</ul>
If you customize these values, make sure to test the actual results as you adjust them.

In the <tt>pToken</tt> member of the <tt>StartupSetting</tt> structure, you can set an identification token that indicates the local host. The default is <tt>NULL</tt>.
This identification token is shared with peers during the connection process, and it is associated with and maintained in <tt>@ref nn::pia::transport::Station</tt>.
You are not required to specify an identification token if you do not need to use one.

The <tt>@ref Startup</tt> function is the only way to specify and change an identification token that indicates the local host.
There is no supported method for changing an identification token while a session is in use.

If the bitrate detection feature is enabled, you must set the <tt>uplinkBitRateLowerLimit</tt> and <tt>bitRateCheckPacketSize</tt> members of the <tt>@ref StartupSetting</tt> structure.
Both members default to an invalid value. Set the minimum bitrate (in bits per second) required by the application in <tt>uplinkBitRateLowerLimit</tt> and the IP packet size (in bytes) to use for measurements in <tt>bitRateCheckPacketSize</tt>.

@attention  Do not transition to sleep mode during a call to this function during local communication.

@param[in] startupSetting  Specifies the settings to use for startup.

@return  Returns a <tt>Result</tt> value that indicates success if the process succeeds. If this function call fails, one or more of the following <tt>Result</tt> values is returned.
Error Return Values:

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. This result is only returned during local communication. Programming error. Fix your program so that this error is not returned.

@see  Cleanup
virtual void nn::pia::session::Session::Trace ( u64  flag) const
virtual

Prints information that is useful for debugging.

Parameters
[in]flagSpecifies the bitwise OR of trace flags. For more information, see the TraceFlag API reference.
void nn::pia::session::Session::UnregisterJoiningApprovalCallback ( )

Unregisters the callback function that is called to determine whether to approve or deny a join request.

See also
RegisterJoiningApprovalCallback
void nn::pia::session::Session::UnregisterSessionEventCallback ( )

Unregisters the callback function registered for changes to the session state.

See also
RegisterSessionEventCallback
nn::Result nn::pia::session::Session::UpdateApplicationDataAsync ( const void *  pApplicationData,
size_t  dataSize 
)

Updates application-defined data.

Asynchronously updates application-defined data (the data set in beacons during local communication). Only the session host can execute this function. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedUpdateApplicationData to check whether the process has completed and GetUpdateApplicationDataResult to check the result.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Either the specified pApplicationData is Null or the dataSize has exceeded the value that can be set. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that the local station is the host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

Parameters
[in]pApplicationDataThe application-defined data to update.
[in]dataSizeThe size of the specified application-defined data.
See also
IsCompletedUpdateApplicationData, GetUpdateApplicationDataResult, IsHost
nn::Result nn::pia::session::Session::UpdateJointSessionApplicationDataAsync ( const void *  pApplicationBuffer,
size_t  dataSize 
)

Updates joint session application-defined data.

Asynchronously updates joint session application-defined data. Only the joint session host can execute this function. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedUpdateJointSessionApplicationData to check whether the process has completed and GetUpdateJointSessionApplicationDataResult to check the result.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument Either the specified pApplicationBuffer is Null or the specified dataSize has exceeded the value that can be set. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. Make sure that no other asynchronous processes are running, that Startup has been called, and that the local station is the joint session host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

Parameters
[in]pApplicationBufferThe application-defined data to update.
[in]dataSizeThe size of the specified application-defined data.
See also
IsCompletedUpdateJointSessionApplicationData, GetUpdateJointSessionApplicationDataResult, IsJointSessionHost
nn::Result nn::pia::session::Session::UpdateJointSessionSettingAsync ( UpdateSessionSetting pUpdateSessionSetting)

Updates the joint session settings.

This function cannot be used with local communications. Updates the joint session settings asynchronously. Only the joint session host can execute this function. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedUpdateJointSessionSetting to check whether the process has completed and GetUpdateJointSessionSettingResult to check the result.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. This function is not supported in local communication. Programming error. Fix your program so that this error is not returned. For Internet communication, make sure that no other asynchronous processes are running, that Startup has been called, and that the local station is the joint session host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

Parameters
[in]pUpdateSessionSettingPointer to the UpdateSessionSetting derived class for gathering the settings to change.
See also
UpdateSessionSetting, IsCompletedUpdateJointSessionSetting, GetUpdateJointSessionSettingResult, IsJointSessionHost
nn::Result nn::pia::session::Session::UpdateSelectionPriority ( u8  priority) const

Updates the matchmaking priority when a session with the same requirements is found.

This function cannot be used with local communications. If the value is being updated multiple times during the session with something other than 0 or nn::pia::inet::SESSION_MAX_SELECTION_PRIORITY, you must wait 30 seconds between calls. Use nn::pia::session::Session::IsUpdatableSelectionPriority to check whether an update can be made. When searches are performed using nn::pia::inet::SELECTION_METHOD_BROADEN_RANGE_WITH_SELECTION_PRIORITY, matchmaking opportunities are prioritized according to the greatest matchmaking priority value. When searches are performed using nn::pia::inet::SELECTION_METHOD_SCORE_BASED, the set score calculation is used. You can check the settings by checking the progress values in the NMAS matchmaking session list.

Returns
Returns a Result value for which the IsSuccess() function returns true. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidArgument The specified argument exceeds the maximum allowed value. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultInvalidState Cannot execute because either the LAN matching feature is being used or the station is not the host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultTemporaryUnavailable Called within 30 seconds of the previous call with values other than 0 or SESSION_MAX_SELECTION_PRIORITY. Use nn::pia::session::Session::IsUpdatableSelectionPriority to confirm whether an update is possible before calling.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

Parameters
[in]priorityThe progress in the game.
See also
IsUpdatableSelectionPriority
nn::Result nn::pia::session::Session::UpdateSessionSettingAsync ( UpdateSessionSetting pUpdateSessionSetting)

Updates the specified session settings.

This function cannot be used with local communications. This function asynchronously updates the specified session settings. Only the session host can execute this function. The started process advances by periodically calling the nn::pia::common::Scheduler::Dispatch function. Use IsCompletedUpdateSessionSetting to check whether the process has completed and GetUpdateSessionSettingResult to check the result.

Returns
Returns a Result value that indicates success if the asynchronous process starts successfully. If this function call fails, one or more of the following Result values is returned.
Error Return Values:

nn::pia::ResultInvalidState Indicates that the instance was not in a valid state when the function was called. This function is not supported in local communication. Programming error. Fix your program so that this error is not returned. For Internet communication, make sure that no other asynchronous processes are running, that Startup has been called, and that the local station is the host. Programming error. Fix your program so that this error is not returned.

nn::pia::ResultNetworkConnectionIsLost The network is not available. The wireless switch may be turned off, there may be a problem with the access point, or the connection to the game server may have been lost. If this error occurs during Internet communication, convert to a network error code and display in the error viewer applet/EULA applet. However, during local communication, do not display it as an error with error code in the error viewer applet/EULA applet. Reconnect to AC.

Parameters
[in]pUpdateSessionSettingPointer to the UpdateSessionSetting derived class for gathering the settings to change.
See also
UpdateSessionSetting, IsCompletedUpdateSessionSetting, GetUpdateSessionSettingResult, IsHost